Friday, July 1, 2016

IISExpress - Accessing ASP.NET MVC 4 development sites in LAN

This page by Microsoft describes how to set up access to IIS Server Express from other computers on the local network.
In a nutshell:
1) from a command prompt with admin privileges:
netsh http add urlacl url=http://[your ip address]:8181/ user=everyone
2) In Windows Firewall with Advanced Security, create a new inbound rule for port 8181 to allow external connections
3) In applicationhost.config, in the node for your project, add:
<binding protocol="http" bindingInformation="*:8181:[your ip address]" />
Do NOT add (as was suggested in another answer):
<binding protocol="http" bindingInformation="*:8181:*" />
The above wildcard binding broke my access from http://192.168.1.6:8181/

FROM HERE:
http://stackoverflow.com/questions/4831097/bad-request-invalid-hostname-iis7

Also,

edit applicationhost.config in C:\Users\USER\Documents\IISExpress\config:

Find <site name="YOURSITE">
and add a new binding like this:
<bindings> <binding protocol="http" bindingInformation="*:2959:127.0.0.1" /> <binding protocol="http" bindingInformation="*:2959:192.168.1.107" /> </bindings>

(Here it's added for 192.168.1.107)


IMPORTANT NOTE:

If, usually after some time, you cannot open your site from remote ip (i.e. 192.168.1.107), and you receive HTTP Error 500 Service Unavailable, and even restarting the whole computer doesn't help, than you should try to switch to a new port ( ideally, something around 50000 - like 52959) and re-apply the process above. That seems to be some kind of IIS bug.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...