Search code examples
c#wcfportforwarding

WCF hosting and port forward issue


I am beginner for WCF technology. So I create a simple wcf service hello application. It is working fine in my own network but when I host it one another machine out of my network then my wcf client is not being able to connect wcf service. I host my wcf on a machine which has static IP but still no luck. I searched Google and came to know that I need to forward port from that machine router, but unfortunately I have no access to the router of that machine. So please tell me how to handle this situation. Tell me what is short cut way as a result my client wcf can connect wcf server apps.

I am familiar with web service. When we host web service in remote machine then we can connect web service from any remote machine. This kind of port forwarding problem was not there.

1) I host my wcf service in windows application on remote machine.windows application is running along with wcf service but client not being able to connect it. If I host wcf service in IIS of remote machine then also do I need to forward port on remote machine?

My concept is not clear regarding wcf hosting. So please tell me when I need to forward port for wcf service.

2) Do I need to forward port when I host wcf service in win application or win service? 3) Do I need to forward port also when I host wcf service in IIS?

4) Is there any way that when wcf service run on remote machine first time then routine will be called from my win application which will forward port programmatically.

Please discuss my all points in detail, thanks.


Solution

  • You need IIS server (web server) to host WCF service. Just like you can open a website from the internet, you need to be able to open a WCF service. If it is being hosted in HTTP, IIS server should do. It needs its own address and port. You can also use TCP connection in the WCF. First of all, you need a webserver and add a sample webpage to that server and view that webpage from your end and then deploy the service to the IIS server and configure it. You need access to that server to configure start/restart the WCF service. It is just like a webpage.

    It should work like http://somewebsiteaddress234234.com:234242344/YourServiceName1.svc

    http://address:port/servicename.svc