How to enable external request in IIS Express?

前端 未结 26 1163
借酒劲吻你
借酒劲吻你 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:29

    Another way to access external requests is to use IIS instead of IIS Express. In my visual studio, I can just switch easily.

    0 讨论(0)
  • 2020-11-22 02:30

    You may try setting up port forwarding instead of trying to modify your IIS Express config, adding new HTTP.sys rules or running Visual Studio as an Admin.

    Basically you need to forward the IP:PORT your website runs at to some other free port on your machine but on the external network adapter, not localhost.

    The thing is that IIS Express (at least on Windows 10) binds to [::1]:port meaning it listens on IPv6 port. You need to take this into account.

    Here is how I made this work - http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html

    Hope it helps.

    0 讨论(0)
  • 2020-11-22 02:31

    I solved this problem by using reverse proxy approach.

    I installed wamp server and used simple reverse proxy feature of apache web server.

    I added a new port to listen to Apache web server (8081). Then I added proxy configuration as virtualhost for that port.

    <VirtualHost *:8081>
    ProxyPass / http://localhost:46935/
    ProxyPassReverse / http://localhost:46935/
    </VirtualHost>
    
    0 讨论(0)
  • 2020-11-22 02:31

    I did the following and was able to connect:

    1) changed IIS express config binding from local host to '*'

    binding protocol="http" bindingInformation="*:8888:*"

    2) Defined inbound rule on firewall to allow the particular port for the protocol type: tcp

    3) Add the following command to add network configuration for your port: netsh http add urlacl url=http://*:8888/ user=everyone

    0 讨论(0)
  • 2020-11-22 02:32

    I had a local IIS enabled so i just created a rewrite rule to my debugging port... I think this is better and cooler than other method because it is easier to remove once am done developing... Here is how the rewrite looks..

    <rewrite>
        <rules>
            <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                <match url="^dev/(.*)" />
                <action type="Rewrite" url="http://localhost:47039/{R:1}" />
            </rule>
        </rules>
    </rewrite>
    

    VS also allows you to develop using your local IIS directly (which then allows remote connections) but in turn you must always run it as an administrator... I dont like that.

    0 讨论(0)
  • 2020-11-22 02:34

    If you have tried Colonel Panic's answer but doesn't work in Visual Studio, try this:

    Append another <binding /> in your IIS Express config

    <bindings>
        <binding protocol="http" bindingInformation="*:8080:localhost" />
        <binding protocol="http" bindingInformation="*:8080:hostname" />
    </bindings>
    

    Finally, you have to run Visual Studio as Admin

    0 讨论(0)
提交回复
热议问题