Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Access IIS Express Website From Remote Machine

0.00/5 (No votes)
7 Aug 2014 1  
Access IIS Express Website From Remote Machine

IIS Express Run From a Remote Machine

Sometimes, running a web application using IIS Express using localhost is fine, but if you want to use the IP address and port to access it from another machine, then you need to configure IIS Express. For example, if you see this error:

Invalid hostname

Invalid hostname

You can get to the IIS Express settings applicationhost.config by going to IISExpress\config in your documents folder.

The important section of the config file are the sites listings:

<site name="WebApplication1" id="45">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" 
physicalPath="C:\visual_studio_projects\WebApplication1\WebApplication1" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:60106:localhost" />
</bindings>
</site>

To access it from another machine, you need to add an extra entry for the binding like this:

<binding protocol="http" bindingInformation="*:60106:192.168.234.12" />

But after restarting IIS Express which is accessible from the try icon, you may get this:

Visual Studio error

Visual Studio error

Usually, all you need to do is start a command console as administrator and run this command:

netsh http add urlacl url=http://192.168.234.12:60106/ user=everyone

To delete the same urlacl, run this:

netsh http delete urlacl url=http://192.168.234.12:60106/

But sometimes, that does not always work and you still cannot run the web application by its IP address. The other approach is to run Visual Studio as administrator. This can be tedious every time you start Visual Studio up, so find its executable which is usually under:

C:\Program Files (x86)\Microsoft Visual Studio {version}\Common7\IDE

Right click the devenv.exe icon and choose properties. Then select the compatibility tab.

Change the Privilege Level to run as administrator like this:

Visual Studio .exe properties

Visual Studio .exe properties

You can also choose to change this setting for all users if you wish.

Now, you should be able to run your web application from another machine such as virtual machine.

Happy coding!

Related Posts

The post Access IIS Express Website From Remote Machine appeared first on Don't Believe The Type.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here