Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not connect to net.tcp: The connection attempt lasted for a time span

Tags:

c#

wcf

On remote build machine, I get the following error when I run my unit test.

Test method MyNameSpace1.MyNameSpace2.Service.Test.MyPath.XYZServiceTest.FindRecord threw exception: System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://localhost/MyABCServices/XYZService.svc. The connection attempt lasted for a time span of 00:00:02.0086605. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:808

I have very limited access to this build machine. I do not have access to iis on build machine or the services like I do on my local dev machine. The unit tests work on my local dev machine but they run in to error mentioned above on build machine.

What can I do to debug this error? I have read things like check the fire wall etc. But I do not know how to do that? I can not check if the windows service for this service is up and running on the build machine. I tried to log into the build machine or connect my IIS to this remote machine but I could not.

like image 655
dotnet-practitioner Avatar asked Dec 21 '12 00:12

dotnet-practitioner


1 Answers

The most common problem for me is the Windows Service Net.Tcp Listener Adapter is not running on the hosting machine.

Also check your IIS Web Application to ensure Enabled Protocols includes net.tcp. For instance mine has "http,net.tcp" and in my bindings I have "http::94:,net.tcp:194:"

I don't know of any good way to remotely check that IIS is configured correctly or the Windows Service is running. Do you not have a server admin that can look at these values for you?

like image 57
Erik Noren Avatar answered Sep 20 '22 19:09

Erik Noren