Is it possible to use IIS Express to host pages on a network. Out of the box it can do localhost but I am trying to bind it to an IP address.
-
1You can do it without config changes with our extension (Conveyor) marketplace.visualstudio.com/…– Jim W says reinstate MonicaJul 5, 2018 at 22:26
-
1@JimW, Yours is the best response IMO, worked quickly and seamlessly. Thanks! You should make yours answer.– VmanDec 17, 2018 at 11:38
5 Answers
I think you can.
To do this you need to edit applicationhost.config
file manually (edit bindingInformation '<ip-address>:<port>:<host-name>
')
To start iisexpress, you need administrator privileges
-
3that was it. Copied the applicationhost.config and modified the binding to <bindings> <binding protocol="http" bindingInformation=":8080:<ip address>" /> </bindings>– jdiazFeb 2, 2011 at 22:08
-
35This information is great: thank you. I learned the hard way that to open IIS to external traffic (not localhost) you need to be running as Administrator. (I was testing a tablet on my LAN). If you're working from Visual Studio run it as Administrator so the access extends to its sub-processes. This will open up IISExpress to bind to something other than localhost.
<binding protocol="http" bindingInformation="*:8081:localhost" /> <binding protocol="http" bindingInformation="*:8083:192.168.2.102" />
Feb 4, 2013 at 15:40 -
24Note To Self : If you get Access Denied, Run Visual Studio as Admin. Oct 15, 2013 at 0:13
-
37UPDATE FOR VISUAL STUDIO 2015: In Visual Studio 2015 the IIS Express configuration files have moved. They are now separate per project, and stored in /{project folder}/.vs/config/applicationhost.config johan.driessen.se/posts/… Feb 6, 2016 at 5:00
-
7UPDATE FOR VISUAL STUDIO 2017 TO 2019: The files have been moved from
/{project folder}/.vs/config/applicationhost.config
to/{project folder}/.vs/{solution name}/config/applicationhost.config
. I ran into the problem of supporting two versions of vs and forgot to modify the right config Oct 31, 2019 at 18:20
In order for IIS Express answer on any IP address, just leave the address blank, i.e:
bindingInformation=":8080:"
Don't forget to restart the IIS express before the changes can take place.
-
35IIS Express must run as Administrator to bind to anything but
localhost
. If launching fromVS 2010
, runVS 2010
as Administrator.– Eric J.Apr 19, 2012 at 21:42 -
5Note To Self : If you get Access Denied, Run Visual Studio as Admin. Oct 15, 2013 at 0:14
-
3Just to add to those who might suffer like me for 3 hours, there are many
bindinginformation
attributes in theapplicationhost.conifg
file, choose the one that belong to your site! May 23, 2014 at 0:16 -
7Make sure to run Visual Studio as Administrator and set
bindingInformation=":8080:"
notbindingInformation="*:8080:*"
to stop Visual Studio from writing a new<site>
entry after restarting Visual Studio Feb 11, 2015 at 1:13 -
3This workaround did the trick for me
bindingInformation=":8080:"
. For some reason*8080*
wasn't working for .NET Core Web apps. Don't forget to runnetsh: netsh http add urlacl url=http://*:8080/ user=\Everyone
to avoid running VS as admin and also add a firewall rule for this port in your Windows Firewall or the app that manages firewall settings. Jan 24, 2018 at 9:41
As mentioned above, edit the application host.config. An easy way to find this is run your site in VS using IIS Express. Right click the systray icon, show all applications. Choose your site, and then click on the config link at the bottom to open it.
I'd suggest adding another binding entry, and leave the initial localhost one there. This additional binding will appear in the IIS Express systray as a separate application under the site.
To avoid having to run VS as admin (lots of good reasons not to run as admin), add a netsh rule as follows (obviously replacing the IP and port with your values) - you'll need an admin cmd.exe for this, it only needs to be run once:
netsh http add urlacl url=http://192.168.1.121:51652/ user=\Everyone
netsh can add rules like url=http://+:51652/ but I failed to get this to place nicely with IIS Express. You can use netsh http show urlacl
to list existing rules, and they can be deleted with netsh http delete urlacl url=blah
.
Further info: http://msdn.microsoft.com/en-us/library/ms733768.aspx
-
4
-
2I have had success with
netsh http add urlacl url=http://*:10368/ user=everyone
and<binding protocol="http" bindingInformation=":10368:" />
(using "*" instead of "+"). This will enable IIS Express to bind to all available IP addresses. Mar 6, 2020 at 13:41 -
netsh didn't stop me from having to run as administrator. God I just give up. Jul 27, 2020 at 16:19
-
Below are the complete changes I needed to make to run my x64 bit IIS application using IIS Express, so that it was accessible to a remote host:
iisexpress /config:"C:\Users\test-user\Documents\IISExpress\config\applicationhost.config" /site:MyWebSite
Starting IIS Express ...
Successfully registered URL "http://192.168.2.133:8080/" for site "MyWebSite" application "/"
Registration completed for site "MyWebSite"
IIS Express is running.
Enter 'Q' to stop IIS Express
The configuration file (applicationhost.config) had a section added as follows:
<sites>
<site name="MyWebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\build\trunk\MyWebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:192.168.2.133" />
</bindings>
</site>
The 64 bit version of the .NET framework can be enabled as follows:
<globalModules>
<!--
<add name="ManagedEngine" image="%windir%\Microsoft.NET\Framework\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" />
<add name="ManagedEngineV4.0_32bit" image="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" />
-->
<add name="ManagedEngine64" image="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" />
-
Great detailed answer. Wish I could upvote +50. I appreciate that you had the paths in there for applicationHost.config and all details. Thanks.– raddevusJun 14, 2015 at 18:52
Change bindingInformation=":8080:"
And remember to turn off the firewall for IISExpress
-
Allowing IIS Express through the firewall will not help. Only opening the port– AndriiDec 5, 2021 at 12:36