Click here to Skip to main content
15,910,358 members
Articles / Web Development / IIS

Access IIS Express Website From Remote Machine

Rate me:
Please Sign up or sign in to vote.
4.63/5 (5 votes)
7 Aug 2014CPOL2 min read 41.6K   7   3
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:

XML
<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:

XML
<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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Asterope Systems Ltd
United Kingdom United Kingdom
Software developer for over 10 years mainly creating enterprise web applications using the Microsoft .Net stack.

Owner of Asterope Systems Ltd specializing in consulting/contracting.

Comments and Discussions

 
SuggestionAn even simpler option Pin
JDL Wright18-May-18 5:33
JDL Wright18-May-18 5:33 
QuestionVisual Studio 2015 uses different configuration file Pin
Jon Eldridge21-May-15 22:14
Jon Eldridge21-May-15 22:14 
QuestionA simpler solution Pin
Ionut-Cristian Florescu30-Apr-15 5:36
Ionut-Cristian Florescu30-Apr-15 5:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.