Access WCF service from machine other than localhost

Go To


I am writing a WCF webservice. I need to access the service from another ( linux ) machine.

On my PC, I can access the url via 'localhost' just fine, however accessing it from another machine ( replacing localhost with the machine's name ) does not work.

I am relatively new to WCF and my guess is I need to configure it to allow requests from other machines, but I do not know how to do this.

Here is the output from netstat if it helps. Thanks!

C:\Users\bb\Desktop>netstat -na | findstr 57566


2012-04-03 20:33
by Poul
Make sure the server machine is not blocking port 57566 - Tudor 2012-04-03 20:35
That seems more like a networking question, not programming related -> off-topic - Darin Dimitrov 2012-04-03 20:35
Well, how do you try to call wcf service from linux? c++ - Mustafa Ekici 2012-04-03 20:36
@mekici, if the WCF exposes an interoperable format such as SOAP or JSON there are libraries for that for almost any imaginable platform and language - Darin Dimitrov 2012-04-03 20:37
@DarinDimitrov yea thats right, it can be gSOA - Mustafa Ekici 2012-04-03 20:38
Why not try something simpler first? like testing your service from another Windows machine using WcfTestClient - surfen 2012-04-03 20:39
How are you hosting your service? IIS or the built-in web server from Visual Studio? If it's the Visual Studio ("Cassini") web server, you cannot access it from other machines - David Hoerster 2012-04-03 20:44
Tudor/Darin - I didn't know if this was a security feature of WCF or not which is why I posted it under WCF instead of networking. If WCF by default is configured to allow access from any machine just let me know and I will close. Thanks - Poul 2012-04-03 20:48
Mekici - On Linux, my client is again the web browser, but this time the url points at my windows machine dns name instead of localhost (which works on the windows machine). Since my route is accessed via a GET this should work, but doesn't - Poul 2012-04-03 20:53
David - I am hosting currently using the built in web server in visual studio - Poul 2012-04-03 20:54
@Poul - that's your problem. Cassini does not allow external connections - David Hoerster 2012-04-03 20:54
@Poul they will not see your comment, use @ and his/hername, you have to use that character and hisname to inform someone - Mustafa Ekici 2012-04-03 20:54


How are you hosting your service? IIS or the built-in web server from Visual Studio? If it's the Visual Studio ("Cassini") web server, you cannot access it from other machines.

See this Stack Exchange question, which is similar:

Microsoft wants you to deploy your application to IIS for remote connections. Cassini (the Visual Studio web server) is purely for development purposes.

2012-04-03 20:54
by David Hoerster
This might be it. Thanks David - Poul 2012-04-03 20:57
I'm glad I could help. Good luck! - David Hoerster 2012-04-03 20:59


Are you running the service using Visual Studio? The ASP.NET Development Server, which Visual Studio uses by default, can only be accessed from localhost. Depending on what you are doing, you may be able to use IIS Express from within Visual Studio. Otherwise you will need to host your service in IIS.

2012-04-03 20:58
by David Nelson
Thanks David. I will check out IIS Express as well.. We are a linux shop who took on a vendor who we can only communicate to via a C# API. Given all of our infrastructure is linux we are building a web service interface to his API so that the rest of our scripts/apps can access it - Poul 2012-04-03 21:07