IIS Express host site on public ip

Date: 2024-11-15
  • Run Visual Studio and/or IIS Express as Administrator
  • Change the file:
    MyWebsite\.vs\MyWebsite\config\applicationhost.config
  • Add an extra binding ‘*.{port}.*’, without altering/removing the localhost port/domain combination
    (if you remove the localhost domain, visual studio creates a whole new site config ignoring your changes)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- ... -->
    <system.applicationHost>
        <sites>
            <site name="MyWebsite" id="9">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\workspace\MyWebsite\public" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:5105:localhost" />
                    <binding protocol="https" bindingInformation="*:44300:localhost" />
					<binding protocol="http" bindingInformation="*:5105:*" />
                    <binding protocol="https" bindingInformation="*:44300:*" />
                </bindings>
            </site>
            <!-- ... -->
        <sites>
    </system.applicationHost>
    <!-- ... -->
</configuration>
            
90410cookie-checkIIS Express host site on public ip