SOAP Service "A socket operation was attempted to an unreachable host" - c#

I'm using C# WinForms app to receive data from the remote SOAP service and it's working great on every testing machine with VPN connected/disconnected.
But there is an exception on one PC after connecting it to VPN network:
System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: A socket operation was attempted
to an unreachable host XX.XX.XX.XX:443
If it's not connected to VPN its receiving data from the service as intended.
What's wrong there? I've tried to disable AVG and firewall but no success.
Is there port blocked after VPN connected or maybe VPN using the same port?... I really don't know what to do :)
netstat doesn't show 433 port in use, btw
I guess this is port issue but who knows...

Related

C# console app web socket - clients not able to connect

I created a C# console app web socket. It works and handles everything on my local machine, but now I have uploaded it on a real server so I can connect to it anytime.
But when I connect to the server endpoint, no connection is being made. I get this error:
WebSocket connection to 'ws:// ... :8083/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
I have opened the port using:
netsh firewall add portopening TCP 8083 "NetBIOS TCP Port 8083"
and I've also tested to see if it's listening, and it is:
netstat -na | find "8083"
I repeat that the console app web socket was working on my local machine, but not working on the real server.
Any thoughts on this? Thank you!

Error while trying to call a wcf service

I'm trying to connect to a WCF service on a server.
I've set up a Site in the IIS on the server and set the Enabled Protocols to http,net.tcp.
Additionally, I configured the Site Bindings like this:
http > Port: 80 > IP Address: *
net.tcp > Binding Information: 808.*
Under Authentication, I've enabled Anonymous Authentication and Windows Authentication.
The services Net.Tcp Listener Adapter and Net.Tcp Port Sharing Service are running too.
When I call the webservice with a browser (via http), everything works and I can list the wsdl etc.
But when trying to connect via tcp, I get the following error:
Error: Cannot obtain Metadata from net.tcp://myserver/MyService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.tcp://myserver/MyService.svc Metadata contains a reference that cannot be resolved: 'net.tcp://myserver/MyService.svc'. Could not connect to net.tcp://myserver/MyService.svc. The connection attempt lasted for a time span of 00:00:21.0010999. 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 10.x.yyy.zz:808. 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 10.x.yyy.zz:808
Are there any other things I have to make sure to be able to connect via tcp?
Thanks in advance
This seems to be a network issue since 10060 means connect timeout.
Check the server firewall and make sure that Windows Communication Foundation Net.TCP Listener Adapter (TCP-In) rule is enabled.
Check the client computer's firewall and add make sure an outbound rule allowing tcp connections on port 808
If you still can't connect, a network firewall device might be blocking the request
I think that you may need to turn metadata exchange on:
The following explains one way to do it.

Connecting to Server on One Computer from another with TCP Listener/Sockets

I have a simple server I can run on one computer that a simple chat client can connect to. When I run the server on my local, I can connect to it fine from a client also on the local. The problem is that I can't seem to connect to the server from a client on another computer.
Some example code from the client:
static string ipAddr = "<server local IP address>";
static Int32 port = 4296;
static System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient();
tcpClient.Connect(IPAddress.Parse(ipAddr), port);
The remote client hits an exception on that last line. The specific error:
An unhandled exception of type 'System.Net.Sockets.SocketException occurred in System.dll
Additional information: 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.
The server is creating a connection in a similar fashion, on the same port, but on the localhost IP 127.0.0.1, for reference.
I have tried forwarding the port on my router (TCP), as well as opening the inbound and outgoing ports for TCP in my Firewall (I know this isn't sustainable -- just trying to get it working at the moment).
I am pretty confident the issue is that the remote client cannot see the server, but doing a netstat on the port indicates it is listening when the server is running, and is running when the local client is connected. Checking the port through Canyouseeme does actually say that the port is not open, so have I just somehow forwarded the port incorrectly?
Any advice? Thanks very much!
The server is creating a connection in a similar fashion, on the same port, but on the localhost IP 127.0.0.1, for reference.
The server is bound to the loop-back address. Hence when you connect from client running from same machine as server, connect is successful. If the client is external to server's machine, it cannot connect to server on 127.0.0.1 in the other machine.
Bind the server to a valid IP address, reachable from client.

Socket programming issue in Silverlight

I have a silverlight application that is communicating with a server hosted in cloud. The application works properly when the server is listening on localhost, but when I make it listen on the server port and make my client access the socket, I get the error "Access denied"
Digging deep, I also found the error in ScopeId resolution
Error Code: 10045
e.RemoteEndPoint. Address.ScopeId threw an exception
The attempted operation is not supported for the type of object referenced.
at System.Net.IPAddress.get_ScopeId()
Thank You
"In Silverlight version 4 for a connection request using System.Net.Sockets, an application can choose instead to retrieve the policy file via the HTTP protocol on TCP port 80 instead of the custom TCP protocol on port 943. This allows HTTP servers that are already running HTTP services to authorize socket connections from Silverlight applications without having to deploy a new TCP service on the machine and open a port through a firewall for port 943."
http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx

Is this error because GMail is blocked?

I wrote a simple app to send an email via GMail SMTP servers. However, it returns an exception at runtime.
At my workplace gmail is blocked (cannot access gmail.com). Is this error because of that?
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebExceptio
n: Unable to connect to the remote server ---> System.Net.Sockets.SocketExceptio
n: A connection attempt failed because the connected party did not properly resp
ond after a period of time, or established connection failed because connected h
ost has failed to respond 74.125.113.109:587
Yeap, it looks like it is related to that. The request could be blocked by the firewall.
They are most likely blocking outbound traffic on port 587.
The answer is probably yes. There is a small possibility that the gmail server was down when you tried to access it, but it's clear that since you're blocked, you won't be able to connect.
No, it's because your network administrator has blocked this IP or port in the company's firewall.
Yes, the exception is coming up because the connection failed, but it might not necessarily be because it's blocked. I can't even connect to that host:
> telnet 74.125.113.109 587
Trying 74.125.113.109...
telnet: connect to address 74.125.113.109: Connection refused
Edit: on second look, I can connect to that host from another machine. There might be other connectivity issues afoot.

Categories