Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I run in VS, I get no errors and it finds the webservice no problem. How can I get it to work without being in VS - aka why is VS finding the port on another machine. To verify that VS is going across the network to find the service, I remote login to the server and shut down the service and so it fails which means it must be using the web service in VS.

When I don't run under VS, I get the following exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://cgy-ztitestpc2:4006/PICS/DiagnosticService. The connection attempt lasted for a time span of 00:00:02.1093615. TCP error code 10061: No connection could be made because the target machine actively refused it ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
Updated 19-Jan-11 7:55am
Dale Haessel 20-Jan-11 14:54pm    
Resolved when relogged in after overnight reboot.

Most likely reason is that when you run from VS it uses a different copy of app.config from when you run it outside VS. Assuming that your WCF config is in that file. Check and see if this is the case.
Share this answer
Dale Haessel 19-Jan-11 14:53pm    
See my answer below, I should have posted it as a comment rather than an answer.
I have checked the app.config and it is good. For example, I have a test portal and a production portal on the same machine. I created the production portal (the one having problems) when I wanted to put it into production. The test portal was working & is working fine.

So, to test, I changed the config file to the test portal (5006) and it works. I then change to the production portal (4006) and then it fails.

Both services are deployed on the same machine. For some reason the same config file runs under VS but not outside of VS. Can find the test portals outside but not the production portals. In VS, it can find both portals.

Also, when I run from the server, it finds the portals because the services are local.
Share this answer
OK, the error went away today. I think it went away because I shut down and then relogged in and now it refreshed connections and could find the web service.

Therefore, simply rebooting might help those w/ a similar issue.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900