Connecting to Visual Studio debugging IIS Express server over the lan

前端 未结 10 991
慢半拍i
慢半拍i 2020-11-27 10:19

I have a test ASP.NET MVC3 application developed in VS2012. When I start debugging the app is accessed from the host machine via the request to http://localhost:

10条回答
  •  孤街浪徒
    2020-11-27 11:12

    How to avoid running Visual Studio as an administrator

    Using both Garret's and @shangkeyun's answer you can achieve connecting to the running website without needing to run Visual Studio as an admin user:

    1. Open %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config
    2. Search for your site using name=MySiteName
    3. Duplicate the existing item in the section. You should now have two lines with binding.
    4. Remove the "localhost" part in bindingInformation.
    5. It should now look like this, assuming the port is 12345:

      
      
      
    6. Enable non-admin to bind to port

      netsh http add urlacl url=http://*:12345/ user=Everyone
      

    EDIT 2019: gregmac added a step to whitelist the VS instance. I never needed this, but listing it anyway:

    1. netsh advfirewall firewall add rule name="IISExpress visualstudio app" protocol=tcp localport=12345 dir=in action=allow

提交回复
热议问题