Error while trying to call a wcf service - c#

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.

Related

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

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...

Cannot deploy my web application to remote location through MS build. This error comes up everytime

I am working on a big enterprise environment. When i try to deploy my solution to remote sever using ms build i get this error every time i try to deploy the app.
According to the error message it says it cannot connect but i can ping to the ip. I have even added the host ip and names in both machines host files. I don't know if i am doing anything wrong has anyone come across this before.How did you overcome this?
Note: i have replaced my ip with myip.com... and site name as my site name in this question.(My app is Asp.net MVC 4 Application)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (3847): Web deployment task failed.(Could not complete the request to remote agent URL 'https://myip.com/msdeploy.axd?site=my site name'.) This error indicates that you cannot connect to the server. Make sure the service URL is correct, firewall and network settings on this computer and on the server computer are configured properly, and the appropriate services have been started on the server. Error details: Could not complete the request to remote agent URL 'https://myip.com/msdeploy.axd?site=my site name'. Unable to connect to the remote server 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 myip.com
Any help will really be appriciated
The real error message is buried in the report, but it reads:
"Unable to connect to the remote server 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 myip.com"
This is a TCP connection problem, which means there's probably a simple solution.
It should be straightforward: it means the server you've specified is not operational. If you're certain that your website is currently working (i.e. you can get to it from your web-browser) then it means you've mistyped the server's name or other connection details. It does not mean that msdeploy.axd is having problems because if it were, your client would at least be able to connect.
Check your server's firewall rules, and also ensure that the web server (IIS) is running and is actively listening on the IP address you want (check the site bindings and also the server's network configuration, a dump of ipconfig /all would also be useful).
It was the issue with IIS it was not allowing remote connections. fixed it by allowing remote connections.
In my case it was due to the firewall setting of the host machine. Turning off firewall for local network fixed the problem

ASP.NET website consuming WCF service error

I get the following error on my asp.net website, while trying to invoke a wcf service method:
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 77.XXX.XX.XX:809
And then more in detail, I get a socketexception, webexception and also this endpointnotfoundexception:
There was no endpoint listening at
http://77.XXX.XX.XX:809/RemoteSyncService/ that could accept the
message. This is often caused by an incorrect address or SOAP action.
The wcf service (RemoteSyncService) is hosted in a .net application on the 77.XXX.XX.XX server. The binding used is basicHttpBinding.
The endpoint address, used in the asp.net site web.config is:
http://77.XXX.XX.XXX:809/RemoteSyncService
// this is the same on the remote server
The service code for the asp.net website was automatically generated, by using the 'add service reference' feature in VS2010 (on this address: http://77.XXX.XX.XXX:809/RemoteSyncService/mexHttp, as described in the other remote server).
All works perfectly on the dev machine..
What I tried and works:
running/debugging the asp.net locally, and invoking methods
trying to contact the wcf service with wcf test client
the asp.net site can contact the other server, because a ftp transfer from my asp.net site to the remote server was successful
pinging the remote server
Will provide code if needed..
make sure your production server isn't firewalling you.

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

Unable to run SOAP client-server on separate well connected machines

I am having a soap client-server application which runs well on the same machine. Now i want to separate the server-client entities on two different machines. Have done the proper IIS configurations - both the machines are pingable - but the following error occurs at the client side. 209.2.208.160:51645 is the server socket.
There was no endpoint listening at http://209.2.208.160:51645/Service1.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
For an initial troubleshooting step, I suggest going to the server and running the netstat command to verify that it is listening on port 51645. If it is not, confirm your IIS port settings on the server. MS KB tip on how to view and change these settings for various IIS versions - http://support.microsoft.com/kb/149605.
If the server is listening on port 51645, check to make sure that a firewall is not blocking your incoming client connection on that port - that would explain why your service call works with everything on one machine.

Categories