How to enable external request in IIS Express?

前端 未结 26 1170
借酒劲吻你
借酒劲吻你 2020-11-22 01:55

How can I enable remote requests in IIS Express? Scott Guthrie wrote that is possible but he didn\'t say how.

26条回答
  •  无人共我
    2020-11-22 02:46

    This is what I did for Windows 10 with Visual Studio 2015 to enable remote access, both with http and https:

    First step is to bind your application to your internal IP address. Run cmd -> ipconfig to get the address. Open the file /{project folder}/.vs/config/applicationhost.config and scroll down until you find something like this:

    
        
            
        
        
            
        
    
    

    Add two new bindings under bindings. You can use HTTPS as well if you like:

    
    
    

    Add the following rule to your firewall, open a new cmd prompt as admin and run the following commands:

    netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=12345 profile=private remoteip=localsubnet action=allow
    
    netsh advfirewall firewall add rule name="IISExpressWebHttps" dir=in protocol=tcp localport=44300 profile=private remoteip=localsubnet action=allow
    

    Now start Visual Studio as Administrator. Right click the web projects project file and select Properties. Go to the Web tab, and click Create Virtual Directory. If Visual Studio is not run as Administrator this will probably fail. Now everything should work.

提交回复
热议问题