How to enable external request in IIS Express?

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

    This is insanely awesome and even covers HTTPS with pretty domain names:

    http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

    The really awesome parts I couldn't find anywhere else on SO in case the above link ever goes away:

    > C:\Program Files (x86)\IIS Express>IisExpressAdminCmd.exe Usage:
    > iisexpressadmincmd.exe <command> <parameters> Supported commands:
    >       setupFriendlyHostnameUrl -url:<url>
    >       deleteFriendlyHostnameUrl -url:<url>
    >       setupUrl -url:<url>
    >       deleteUrl -url:<url>
    >       setupSslUrl -url:<url> -CertHash:<value>
    >       setupSslUrl -url:<url> -UseSelfSigned
    >       deleteSslUrl -url:<url>
    > 
    > Examples: 1) Configure "http.sys" and "hosts" file for friendly
    > hostname "contoso": iisexpressadmincmd setupFriendlyHostnameUrl
    > -url:http://contoso:80/ 2) Remove "http.sys" configuration and "hosts" file entry for the friendly  hostname "contoso": iisexpressadmincmd
    > deleteFriendlyHostnameUrl -url:http://contoso:80/
    

    The above utility will register the SSL certificate for you! If you use the -UseSelfSigned option, it's super easy.

    If you want to do things the hard way, the non-obvious part is you need to tell HTTP.SYS what certificate to use, like this:

    netsh http add sslcert ipport=0.0.0.0:443 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=YOURCERTHASHHERE
    

    Certhash is the "Thumbprint" you can get from the certificate properties in MMC.

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

    If you're working with Visual Studio then follow these steps to access the IIS-Express over IP-Adress:

    1. Get your host IP-Adress: ipconfig in Windows Command Line
    2. GoTo

      $(SolutionDir)\.vs\config\applicationHost.config
      
    3. Find

      <site name="WebApplication3" id="2">
         <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="C:\Users\user.name\Source\Repos\protoype-one\WebApplication3" />
         </application>
         <bindings>
           <binding protocol="http" bindingInformation="*:62549:localhost" />
         </bindings>
      </site>
      
    4. Add: <binding protocol="http" bindingInformation="*:62549:192.168.178.108"/>
      with your IP-Adress

    5. Run your Visual Studio with Administrator rights and everything should work
    6. Maybe look for some firewall issues if you try to connect from remote
    0 讨论(0)
提交回复
热议问题