Normally my post arnt so short but this burned 45 minutes of my time as I struggled to get a native IIS express deployment from VS2022 to use a lan port for debugging remote connections.
Navigate to \RootProjectDirectory\.vs\{ProjectName}\config\applicationhost.config
Run Visual Studio as Administrator, this is critical.
Delete the file after backing it up, then while in Visual studio click Create Virtual Directory using a different port on HTTP then the one you wish to open on lan
Start the project, then Stop debugging. Once Stopped, confirm IIS is no longer running on the taskbar.
Open the newly generated applicationhost.config file within the config directory and add the new binding, mine existed on line 168.
<binding protocol=”http” bindingInformation=”*:44392:{PUT LAN IP HERE}” />
An example of the config will look like this
<sites>
<site name=”WebSite1″ id=”1″ serverAutoStart=”true”>
<application path=”/”>
<virtualDirectory path=”/” physicalPath=”%IIS_SITES_HOME%\WebSite1″ />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”:8080:localhost” />
</bindings>
</site>
<site name=”ProjectName” id=”2″>
<application path=”/” applicationPool=”Clr4IntegratedAppPool”>
<virtualDirectory path=”/” physicalPath=”C:\Users\User\source\repos\ProjectName\ProjectName” />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:44391:localhost” />
<binding protocol=”http” bindingInformation=”*:44392:192.168.0.199″ />
</bindings>
</site>
<siteDefaults>
<!– To enable logging, please change the below attribute “enabled” to “true” –>
<logFile logFormat=”W3C” directory=”%AppData%\Microsoft\IISExpressLogs” enabled=”false” />
<traceFailedRequestsLogging directory=”%AppData%\Microsoft” enabled=”false” maxLogFileSizeKB=”1024″ />
</siteDefaults>
<applicationDefaults applicationPool=”Clr4IntegratedAppPool” />
<virtualDirectoryDefaults allowSubDirConfig=”true” />
</sites>
Save, then click Start debug within VS. You may now HTTP from your other machine using the newly added port.
This does not work! Once the modification in ‘applicationhost’ has been done and the project run again, it failed to connect to the sever. What ip do you mean. From the server or from client?
It works, I’ve used it before I moved to my new proxy method. Is your goal to allow access from outside of localhost out on the internet or network?