Bind debugger to all IP Addresses instead of only localhost
How can I make visual studio asp.net debugger to bind to 开发者_StackOverflowall ipaddresses of my network instead of localhost? So I can debug under another circumstances.
For IIS Express, grant yourself permission to bind to both localhost and wildcard network adapters, and configure IIS Express to bind to them.
Step details: (they assume a port number of 5555 - use your actual port instead)
Run these commands from a command prompt as Administrator:
netsh http add urlacl url=http://localhost:5555/ user="NT AUTHORITY\INTERACTIVE" netsh http add urlacl url=http://*:5555/ user="NT AUTHORITY\INTERACTIVE"
In %USERPROFILE%\Documents\IISExpress\config\applicationhost.config, add a wildcard binding to your site. The result should look like this:
<site name="..." id="..."> <!-- application settings omitted for brevity --> <bindings> <binding protocol="http" bindingInformation="*:5555:localhost" /> <binding protocol="http" bindingInformation="*:5555:*" /> </bindings> </site>
If you're starting the debug of your project from Visual Studio, there applicationhost.config that will be used resides in another directory. Unfortunately changes to this file interfere with Visual Studio. For the moment I only made it work when I change the file after opening the project in VS and revert it back to it's old stage before opening the project again in VS.
You can find it in .vs\config\applicationhost.config in your project root.
There will you find an - block, where you can replace localhost with a *
<bindings>
<binding protocol="http" bindingInformation="*:50216:*" />
</bindings>
You will also need to add a net acl
netsh http add urlacl url=http://localhost:50216/ user="NT AUTHORITY\INTERACTIVE"
netsh http add urlacl url=http://*:50216/ user="NT AUTHORITY\INTERACTIVE"
You don't bind to an IP address per se. You actually bind to an IIS server instance. If you set up a website on your local machine on the ip address you want to debug, you can then attach to that w3p.exe process (IIS Process).
精彩评论