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.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
I think you can.
To do this you need to edit
applicationhost.config file manually (edit bindingInformation ‘
To start iisexpress, you need administrator privileges
In order for IIS Express answer on any IP address, just leave the address blank, i.e:
Don’t forget to restart the IIS express before the changes can take place.
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
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:Userstest-userDocumentsIISExpressconfigapplicationhost.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:buildtrunkMyWebsite" /> </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.NETFrameworkv2.0.50727webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" /> <add name="ManagedEngineV4.0_32bit" image="%windir%Microsoft.NETFrameworkv4.0.30319webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" /> --> <add name="ManagedEngine64" image="%windir%Microsoft.NETFramework64v4.0.30319webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" />
And remember to turn off the firewall for IISExpress