Using IIS Express to host a website (temporarily)

后端 未结 6 1347
萌比男神i
萌比男神i 2020-11-30 17:20

I have a website (MVC3), which for developement is hosted in IIS Express. (I\'ve run into a bug of Cassini Devserver and had to upgrade...) Now, I\'m wondering, is it possib

6条回答
  •  旧巷少年郎
    2020-11-30 18:03

    Alternatively, you can use something like AnalogX's PortMapper to act as a small loopback proxy to tunnel privately localhost bound ports to publicly open ports.

    For example,

    • IISExpress is locally bound to localhost:8080
    • PortMapper port 9090 is configured to relay traffic to localhost:8080

    Effectively, any connection on port 9090 (opened by PortMapper) will be tunneled to localhost:8080; thereby bypassing all the netsh nonsense which can be a pain sometimes.

    Below is my configuration:

    PortMapper configuration

    The benefit of using this proxying method is that it does not permanently expose an open IISExpress port on the local dev box.

    Rarely, there are times when I want to open the port publicly for meetings; but most of the time, the port should closed and only be accessible by localhost. Modifying firewall rules on the router every time is a pain. Here's how I have things setup:

    • My router firewall forwards 9090 port to PortMapper
    • PortMapper only continues proxying the traffic to IISExpress (listening on 8080) only if PortMapper is running.

    Note

    Make sure to close out all the PortMapper windows for any changes to take effect.

    Note 2

    As others have described, you might need to adjust the IISExpress bindings for your application in

     My Documents\IISExpress\applicationhost.config
     project\.vs\config\applicationhost.config
    

    to something like:

    
      
    
      
    
      
      
    
    
    

提交回复
热议问题