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

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.

Related

SignalR: Works with "real" IP's but not NAT

I have a self-hosted C# Windows Service written with VS2015 that includes SignalR and uses version 2.2.2 and jquery 3.2.1. It works fine for all the systems that use a "real" (addressable) IP address. But the computers that are behind a NAT cannot. They get a "SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. " error. If you use the URL http://servername/signal/hubs", you get a "Server took too long to respond" error. (clients with real IP's see the source).
Windows Firewall is disabled on the clients. However, the SignalR service is running on 80 and 443 so I wouldn't think that would be a problem. Anyway, I'm so confused at this point, I don't even know what code to post.
What can I check, do, post to figure out why this is not working for NAT'd clients?
EDIT: I had some other people test this and found two of us that use U-Verse had the connection problem. However, the people in the main office who are on the corporate NAT were connecting. So maybe this is something in the U-Verse router/firewall that's stopping the connection. But why would it block ports 80 and 443? Does SignalR do any out of the ordinary on a connection?
EDIT #2: I ran Wireshark on the server. It receives the request from the NAT'd client but keeps retrying to send the response to port 80. I'm not really good at understanding Wireshark or what to look for. Obviously, something is not working properly.
This was quite stupid on my part. I was using a server solely for SignalR that did not have IIS installed... and apparently you need to do that in order for ports 80 and 443 to be open in the firewall. The firewalls on all 18 servers are set to allow access from any of my domain's IP addresses. When using NAT, it uses a completely different IP and therefore was stopped. I opened 80/443 on the SignalR server and all is well... D'oh!

firewalls block client of wshttpbinding service

I have a server pc with Windows Server 2008.and i also have a wcf service that work with Port 8525 and host it with Windows Service.i open the port in server firewall (Added Rule).
My server machine has a Valid IP. so my client try to connect to my service at
((http)://MyServerIP:8525/ServiceName).
all of my application users are people that work in companies.so user internet come from a secure network (Proxy Server Or VPN Connection).
the problem is here :
lots of my clients have the connection problem that seems local network block my program connection (if they try to connect to my server system.diagnostics listener will log it) but service does not save any log.
i think their internet Server has Firewall and it block me.i fixed some of them with
<defaultProxy enabled="true" useDefaultCredentials="true" />
but still lots of them have same problem.and the another annoying problem is the network administrators do not open that port because of security issue and do not help me.
A Common Exception is :
System.ServiceModel.EndpointNotFoundException > System.Net.WebException > System.Net.Sockets.SocketException (on client Side).
this problem did not occur when i connect from home.
My question :
any way to fix this issue with c# code or client app.config? or at least fix this with some change in service config (server side).
The only easy solution is to host that service on port 80
The problem is that some networks do not permit outgoing connection to ports other than permitted services(http,https,pop, etc etc)
Or you can ask sysadmins of those networks to permit traffic to your ip/port
If you have iis on that server you could host wcf on iis.
Remenber that only one process can bind to a port on an address at any one time.
there you can find some info: How can a WCF service listen the same port as IIS?

Client cannot connect to server

I'm newbie in WCF, so I really need your help.
I have two programs which uses WCF.
If they are running on one computer and client uses adress net.tcp:\Localhost:8001\MyService to connect to server(which has adress 192.168.1.1 for example) everything is OK.
But when I'm changing adress for client to net.tcp:\192.168.1.1:8001\MyService I'm getting system.timeoutexception because client cannot connect server.
Thanks for help.
You may need to allow external access to the port in the firewall.
As long as you're communication from localhost to localhost, the firewall doesn't come into play, as these requests are handled by the loopback adapter.
But when communicating from localhost to the machines IP address, you're making a network request that's handled by the firewall (even though you're still on the same machine physically).
By the way: For the server side it doesn't matter whether you start the WCF service with endpoint localhost or 192.168.1.1.
EDIT
I wrote that it doesn't matter whether you listen on localhost or 192.168.1.1 - this is only true if you only have one network adapter available.
As soon as there are two or more network cards (for example: Wireless LAN is turned on and you're connected via cable), localhost or 0.0.0.0 will make the service listen on any adapter. Using 192.168.1.1 will make the service listen only for connections on that IP address.
This is important to know especially in cases where the different network adapters become members of different (sub)networks.
For example: One adapter is connected to the 192.168.1 network and the other adapter is connected to the 192.168.2 network. If your service listens on localhost or 0.0.0.0 it will be reachable from both networks. If it only listens on 192.168.1.1, it will not be available for the 192.168.2 network.
Please check "192.168.1.1" is included in your "hosts" file. And give it a try.
The hosts file can be found in "C:\Windows\System32\drivers\etc"

How to allow remote connections to my .net application?

I'm writing an application with both a desktop and a mobile app component. The desktop app is being written in c#, and I'd like to be able to open it up to act as a server for the mobile app (similar to what AirVideo does). How can I accomplish this without requiring the user to configure their firewall and/or router?
Ideally, I want to self host a restful wcf service in the desktop app. I've tried this already, but the automatic configuration of the firewall doesn't allow remote connections to the wcf service, since it appears to be hosted by the system process. Is there a workaround for this behavior?
Edit: I've solved the router problem as best I can through the use of the NATUPnP COM library (http://pietschsoft.com/post/2009/02/05/NET-Framework-Communicate-through-NAT-Router-via-UPnP.aspx). I still need to know how to allow remote connections through the firewall to a self-hosted WCF service without any manual configuration of the firewall (I'm okay with the user prompt to allow connections once the app is launched).
Set a specific port in your router that is designated to route to your server address,
So if your router real ip is a.b.c.d, you should set up that all communication to a.b.c.d:port# is being routed to your server local address. (a.b.c.d:port# --> serverIP)
The settings for this can be achieved from your router configuration.
In a situation where you cannot tinker with the router setting/firewall settings:
This means you cannot use ports to listen to incoming connections and can only use outgoing connections. to overcome that you will have to use a 3rd server with real IP-Address which will function as a listener for both sides. Typical scenario can be described as follows:
Client Side - A (Desktop)
Client Side - B (Smartphone)
Server Side - S (Communications Server)
S --> Open port for listening to incoming connections.
A --> Connect to S every x seconds to check if requests to do something are waiting.
B --> Connect to S. (issues a waiting request for A)
That way S is served as a proxy to glue both sides' communications.

Port forwarding on Windows 7

How do I redirect an incomming request on port xxx to localhost:yyy on windows 7?
Development Server (vs 2008) only allow access from localhost which isnt good enough. I need to test my app from various computers.
Thanks for the suggestions guys, although I found the answer myself.
I downloaded Microsoft SOAP Toolkit version 3 and started MSSoapT, created a formatted trace listening on port 8080, forwarding to host: 127.0.0.1 port: 3804. My problem was I used "localhost" and not "127.0.0.1".
Now every request made to my development machine from other computers through port 8080 will be redirected to port 3804 where ASP.NET Development Server is statically set to listen when debugging VS.NET webapps.
On the command prompt.
$> netsh
$> interface portproxy
$> add v4tov4 listenport=xxx connectaddress=127.0.0.1 connectport=yyy protocol=tcp
See: http://technet.microsoft.com/en-us/library/cc776297%28WS.10%29.aspx#BKMK_1
If this really is for some testing, you could create a server which listens on a port, and when it receives an incoming connection spawns a thread that opens a connection to the actual local server, and afterward just waits for data to come in either end and shuffle it along to the other end. If either socket closes, the worker thread would terminate. This is obviously not a scalable solution, but for testing it should easily do the trick.
Not really sure what you are looking for. However port forwarding will be relevant when you have a router in place and you need to explicitly forward a request on a specific router port to a specific IP and port on a LAN computer. If you want to access the web server from other LAN computers on the same network then http://ip-address should just work fine. Also make sure that your web server is listening on the LAN IP and is not just bound to localhost.
I'm using windows 7 64 bit and couldn't get the Microsoft SOAP Toolkit to work on my machine for port forwarding and didn't like the free port forwarding software I found out there so I just changed my VS 2010 web app to use local iis, I know this doesn't help people running 2008 but it works if you have 2010... Here's a screen shot of my change: I'm doing this for testing on the iPad...

Categories