Search code examples
visual-studio-2015localhostiis-express

Use machine-name instead of localhost on IIS express


I am running a WCF service thru Visual Studio (2015) and IIS Express.

enter image description here

I can navigate to http://localhost:50122/TestService.svc

enter image description here

What I want to do instead is navigate to http://machine-name:50122/TestService.svc

enter image description here

How do I configure IIS Express to accept machine-name, instead of localhost?

What I tried without success:

  1. In Visual studio Project / Properties / Web / try to change Project Url to http://machine-name:50122/ but VS prevents this !

  2. In the visual studio solution folder there is a hidden .vs\config folder. Within it, there is a file: applicationhost.config; I added another binding (second line) with machine-name

<bindings>
  <binding protocol="http" bindingInformation="*:50122:localhost" />
  <binding protocol="http" bindingInformation="*:50122:intel-nuc" />
</bindings>
  1. If it's useful, both http://localhost and http://intel-nuc both work (default port 80) and point to the default IIS provided demo page - But those are being served by IIS (not IIS Express).

Solution

  • Found this on stackoverflow: How to enable external request in IIS Express? , which also applies to "internal" request.

    The command I used (Run as Admin)

    netsh http add urlacl url=http://intel-nuc:50122/ user=everyone

    Afterwards, you also need to run VS as Admin.