开发者

EndpointNotFoundException when working through tutorials in Learning WCF

I am working through the book Learning WCF and on the first tutorial开发者_如何学JAVA lab HelloIndigo I am receiving the following error.

Could not connect to http://localhost:8000/HelloIndigo/HelloIndigoService. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8000.

It appears in the Client project on the line string s = proxy.HelloIndigo();

EndpointAddress ep = new EndpointAddress("http://localhost:8000/HelloIndigo/HelloIndigoService");

IHelloIndigoService proxy = ChannelFactory<IHelloIndigoService>.
            CreateChannel(new BasicHttpBinding(), ep);
string s = proxy.HelloIndigo();
Console.WriteLine(s);
Console.WriteLine("Press <ENTER> to terminate Client");
Console.ReadLine();

I have intensively googled on this but I am none the wiser.

Can anyone explain the issue and how to remedy?


It could be several things, first things to check are:

  • Is the service running?
  • Is there an endpoint configured a that address?
  • Is there any firewall that is blocking the request?

Try puting the endpoint address in a browser and see if you can browse to it.


In Solution Explorer, right-click the solution and select "Properties". On the left, Under "Common Properties", select "Startup Project". On the right, select "Multiple startup projects" - move "Host" to the top and change Action to Start - move "Client" underneath "Host" and change Action to Start. When you click F5 to debug, studio will first start the Host project in a console app, and then it will start the Client project in a separate console app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜