none
Unable to access WCF service hosted in IIS Express from another machine in the same subnet RRS feed

  • Question

  • Dear All,

    I hosted WCF service using IIS Express and tried to consume it from another machine in the same subnet. 

    The sample I used you can find at, 

    https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/

    Both the devices are connecting to same home Wifi network.

    Device 1:

    A laptop where WCF service hosted in IIS Express

    OS: Windows 10, Visual Studio Community edition

    Ip Address: 192.168.2.6

    Web Server: IIS Express

    Binding: basicHttpBinding

    Device 2:

    A laptop where we have WCF client

    OS: WIndows 7

    IP Address: 192.168.2.7

    I could run the HelloWorld sample from my developer machine and I could connect to the service running athttp://192.168.2.6:9898/HelloWorldService.svc
    from the WCF client in the same machine. Please see the IIS express screenshot attached for the WCF service sites listed.

    Then I tried to access the WCF service from another machine in the same wifi network, it failed.
    It threw an EndPointNotFoundException,
    System error -> System.Net.WebException:Error: Connection failure (No route to host)

    I configured "Remote Access to IIS Express" also I added port 9898 as a exception to Firewall(even disabled the Windows Firewall).

    I tried accessing http://192.168.2.6:9898/HelloWorldService.svc from device 2 but I couldn't.
    Even ping doesn't work from device 2 to developer machine.

    Environment I am in:
    Both the devices are connected to same WIFI connection through a Wireless modem + router(Belkin 300N).
    I could see both the devices are in same subnet with the IP addresses. 

    Anybody faced similar issue accessing WCF service hosted in Windows 10 IIS Express.
    Please point me if I am missing something which blocks access to WCF service hosted in the developer machine.

    Thanks
    Bachu









    • Edited by Bachuu Sunday, March 27, 2016 7:28 AM
    Sunday, March 27, 2016 7:15 AM

Answers

  • Hello,

    >>My understanding is the devices must be reachable while pinging for accessing the exposed WCF service. But even though devices are connected to same home WIFI ping doesn't work between the devices

    >>Even ping doesn't work from device 2 to developer machine.

    Yes, you are right, the devices must be reachable while pinging for accessing the exposed WCF service.
    Based on your description, it seems that you can not ping the IP address of the device 2 in your device 1? If so that will be the reason why your device 2 can not access the WCF service which is hosted in the device 1.

    The reason for that your device1 can not ping with the device2 may be related with Router settings.

    For more information, please try to refer to the following similar thread:
    Two devices cannot ping each other through WiFi.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 7, 2016 3:04 AM
    Moderator

All replies

  • I don't think you can use IIS Express in that manner. It's local to your machine's development environment aka Visual Studio.

    You have to use the local IIS the real one on the machine the Web server.

    Sunday, March 27, 2016 1:17 PM
  • Dear DA924x,

    Thanks for quick reply.

    I just followed the "Configuring Remote Access to IIS Express" section of the Xamarin WCF guide  https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/

    According to this if we do the following steps we should be able to access IIS Express from remote devices.

    1. Configure IIS Express to Accept Remote connections - This step involves editing the config file for IIS Express to accept remote connections on a specific port and then setting up a rule for IIS Express to accept the incoming traffic.
    2. Add an Exception to Windows Firewall - We must open up a port through Windows Firewall that remote applications can use to communicate with the WCF service.

    Below given posts also talk about hosting in IIS Express and accessing it from other devices. I tried exactly same steps but it doesn't work for me.

    My understanding is the devices must be reachable while pinging for accessing the exposed WCF service. But even though devices are connected to same home WIFI ping doesn't work between the devices

    http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

    http://blog.appliedis.com/2013/07/08/accessing-an-iis-express-site-from-an-ipad/

    Thanks

    Bachu


    • Edited by Bachuu Sunday, March 27, 2016 1:55 PM
    Sunday, March 27, 2016 1:44 PM
  • Why would one be bothered with IIS Express when I would assume that Local IIS the real Web server is there? Why mess with the Pinto when the Rolls Royce there. Just be because it worked on the Pinto does it mean that it is going to work on the Rolls Royce, and developers have been burnt because IIS Express is not local IIS the real Web server. 
    Sunday, March 27, 2016 9:55 PM
  • Hello,

    >>My understanding is the devices must be reachable while pinging for accessing the exposed WCF service. But even though devices are connected to same home WIFI ping doesn't work between the devices

    >>Even ping doesn't work from device 2 to developer machine.

    Yes, you are right, the devices must be reachable while pinging for accessing the exposed WCF service.
    Based on your description, it seems that you can not ping the IP address of the device 2 in your device 1? If so that will be the reason why your device 2 can not access the WCF service which is hosted in the device 1.

    The reason for that your device1 can not ping with the device2 may be related with Router settings.

    For more information, please try to refer to the following similar thread:
    Two devices cannot ping each other through WiFi.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 7, 2016 3:04 AM
    Moderator