wcf - No connection could be made because the target machine actively refused it - wcf

I created a WCF service. It worked well yesterday. When I entered service address, I got message returned as expected. However, when I run it today, I received error message:
In IE: [Fiddler] The socket connection to localhost failed.
ErrorCode: 10061. No connection could be made because the target machine actively refused it [::1]:47423
In Firefox: Firefox can't establish a connection to the server at the site
In Fiddle2: HTTP: 502
How to solve this problem? Thanks.

Generally with these issues is either the service is not running or you're url is incorrect. Without more specific information it's impossible to tell.

Related

Why does my secure websocket connection with Godot fail when i connect from Australia to Germany?

please be patient with me because this is my first question ever on this platform. Thanks.
This is the code for a minimal server using the secure websocket protocol wss:// in godot (GDScript):
Gist on github
It works as expected when i connect from my home to my Virtual Private Server hosted in Germany or via VPN from other locations (e.g. US or Europe).
It does not work as expected when friends connect from India or Australia or if i reproduce it with a VPN (e.g. Argentina or Australia).
index.js:8 WebSocket connection to 'wss://(hidden):port/' failed: Error in connection establishment: net::ERR_SOCKET_NOT_CONNECTED.
I looks like the connection fails only if the physical distance between server and client is that long.
The problem might be related to SSL because everything works as expected when i use the normal websocket protocol. I tested the openssl -connect command from home and via VPN: both are good. I also checked my ssl configuration on https://decoder.link/sslchecker/. No issues detected.
This problem might be related to godot because I set up a nodejs secure websocket server, this works, even when i connect from Australia.
Now i dont really know how to proceed to fix this issue so i ask you to point me in the right direction.
Useful documentation on godot docs: WebSocketServer WebSocketClient
Edit 1:
After more tests it got more confusing:
When connecting from India with traffic on the internet connection:
WebSocket connection to 'wss://myDomain:port/' failed: Connection closed before receiving a handshake response
connnetion error
connection close request from server received... client will close the connection
disconnected unexpected
sometimes it even works (when network is not busy)
When connection from Australia: sometimes the ERR_SOCKET_NOT_CONNECTED or the Connection closed before receiving a handshake response connnetion error error comes up.
Edit 2:
only Firefox works, Chrome or Native client don't. I seems Firefox can establish the connection better if the distance is very big between server and client.

Connect to Remotely Hosted WCF Service via netTcpBinding

I can connect to my WCF service locally with no problem but when I host it remotely, I receive this error:
TCP error code 10061: No connection could be made because the target machine actively refused it 192.168.200.58:1991.
Please note that he firewall is already turned off on the host.
I cannot figure out what is wrong. Any help?
Thanks!
Looks like a firewall problem. Check you port 1991 open on the target and client machines
Try using the command (which requires elevated permissions - run as administrator)
netstat -anb
You have likely already searched but I found another question that might guide you to your answer;
WCF No connection could be made because the target machine actively refused

consuming WCF method via web service getting error only in IIS not in IDE

I have added http://ws.hipcricket.com/api/EndUser.svc as a service reference in a my web service. I am able to consume the methods from the IDE but while hosting the same in IIS I'm getting the following errors:
Error 1:
Could not connect to the (please refer the above url). TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.20.116.221:80.
Error 2:
There was no endpoint listening at (please refer the above url) that could accept the message. This is often caused by an incorrect address or SOAP action. See Inner Exception, if present, for more details
Maybe you have a firewall blocking communication from your webserver? When developing on your local machine communications through the proxy may most likely be using your credentials, while the user that the application pool that your application is running under on your IIS server most probably does not have the correct rights.

Uploading files to remote server using WCF

I am new to WCF, I am trying to upload files to remote server using a windows service and WCF. When i run my code i get the below error.
An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll
Additional information: Could not connect to net.tcp://74.208.195.53:5000/. The connection attempt lasted for a time span of 00:00:21.0122019. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.208.195.53:5000.
I tried using the sample project provided in this link http://www.codeproject.com/KB/WCF/WCFDownloadUploadService.aspx
I read in other blogs that, the port has to be allowed throught the firewall on the server.i did that even tried turning off the firewall on the server but it dint help.
Can someone please guide me how i could get this issue resolved.Any help would be highly appreciated. I am using win7 and the remote server is windows server 2008.
Thanks
In some circumstances you need to enable tcp on the server. this post might help

Can't connect to a remote wcf service from IIS

I am able to connect to a remote WCF service from a console or a website/webapplication running on a VS dev server successfully. However, when I try to connect from an IIS hosted website I'm getting the following error. Any idea?
No connection could be made because the target machine actively refused it 12.11.121.12:80
This error:
No connection could be made because the target machine actively refused it
Means that a connection request successfully got through to the target machine (it isn't a firewall issue), on a given port and the target machine was not listening for incoming connections on that port, so the OS refused the connection attempt.
The rest of your error identifies the machine 12.11.121.12 and the port number 80 that the connection was attempted on.
The error indicates that a server isn't running on the target machine. If you know a server is running on the machine you're attempting to connect to, because you can connect to it from another application, then this suggests that your connection details are misconfigured in the website.
So, some things to check:
Are there any differences between the app.config/web.config configuration details for the target webservice? Specifically, the machine name (12.11.121.12) and the port number (80) would seem potentials.
Are you running the IIS hosted website on the same machine as the console/web application that works? If not, do both machines resolve the target server name (are you using someserver.org for example rather than 12.11.121.12 and it is being resolved to a different IP because one server is external facing and the other is internal?
This sounds a lot like a permissions (authentication issue) since the app pool is running under a different user (machine) by default. Since WCF uses the authentication token, I will bet this is your issue. Try setting the identity of the pool to the same user as the console, and I bet it will work fine.
Strangely I got this error when useDefaultWebProxy was "true" from a Web App, but exactly the same code and settings worked ok in a unit test class.
It turns out that the Web App was using the web-browser proxy (corporate policy) of https://foo/bar:1234. When I set this explicitely using:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name=...
useDefaultWebProxy="false" proxyAddress="https://foo/bar:1234"
...
I got the error:
The ServicePointManager does not support proxies with the https scheme
So I changed the proxy address to http, not https, and it worked.