Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EndpointNotFoundException when working through tutorials in Learning WCF

Tags:

c#

wcf

I am working through the book Learning WCF and on the first tutorial 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?

like image 592
Nicholas Murray Avatar asked May 22 '10 12:05

Nicholas Murray


2 Answers

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.

like image 73
Shiraz Bhaiji Avatar answered Oct 20 '22 01:10

Shiraz Bhaiji


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.

like image 27
kicknwing Avatar answered Oct 19 '22 23:10

kicknwing