以前にタスクバーの.asmxサービスで実行されていたWCFサービスをコンソールアプリケーションにラップしようとしています。ServiceHost(コンソールアプリケーション)で実行中のWCFサービス
class Program
{
static void Main(string[] args)
{
Uri uri = new Uri("http://localhost:5000");
using (ServiceHost host = new ServiceHost(typeof(CheckoutService), uri))
{
Console.WriteLine("Prepping CheckoutService server");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.Open();
Console.Clear();
Console.WriteLine("CheckoutService server up and running");
Console.WriteLine("Press Return to stop service at any point");
Console.ReadLine();
host.Close();
}
}
しかし、(サービスコンソールアプリに包まれていた前に働いていた)、このサービスを受ける必要があり、クライアントアプリケーションが今クラッシュされています。ここでは
は、WCFサービスをラップするためのコードですエラーでアウト:There was no endpoint listening at http://localhost:5000/CheckoutService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
app.configをでこのクライアントのエンドポイントの構成は次のとおりです。
<endpoint
address="http://localhost:5000/CheckoutService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICheckoutService"
contract="CheckoutServiceServer.ICheckoutService" name="BasicHttpBinding_ICheckoutService" />
私はおそらく、WCFサービスをホストしているコンソールプロジェクトに何らかの形の.config
ファイルがありませんが、間違っている可能性があります。
キャプテンが大嫌いですが、サービスが実行されていないようです。 – JayC
あなたはホストを開き、コンソールをクリアして、すぐにホストを終了します。すぐにホストを再閉じると、サービスは起動していますか? –
ええ、私はConsole.ReadLine()を見逃していましたが、それを開いたままにしていましたが、それを追加しても、私はまだ同じ問題を抱えています。 – Moza