将调试器绑定到所有IP地址而不是本地主机
问题描述:
如何使visual studio asp.net调试器绑定到我的网络的所有ipaddresses而不是localhost?所以我可以在其他情况下进行调试。将调试器绑定到所有IP地址而不是本地主机
答
您不绑定到IP地址本身。你实际上绑定到一个IIS服务器实例。如果您在本地计算机上设置了要调试的IP地址的网站,则可以附加到该w3p.exe进程(IIS进程)。
答
对于IIS Express,授予自己绑定到本地主机和通配符网络适配器的权限,并将IIS Express配置为绑定到它们。
步骤的细节:(他们承担的5555端口号 - 用你的实际端口代替)
-
从命令提示符下运行这些命令以管理员身份:
netsh http add urlacl url=http://localhost:5555/ user="NT AUTHORITY\INTERACTIVE" netsh http add urlacl url=http://*:5555/ user="NT AUTHORITY\INTERACTIVE"
-
在%USERPROFILE%\ Documents \ IISExpress \ config \ applicationhost.config,为您的网站添加通配符绑定。结果应该是这样的:
<site name="..." id="..."> <!-- application settings omitted for brevity --> <bindings> <binding protocol="http" bindingInformation="*:5555:localhost" /> <binding protocol="http" bindingInformation="*:5555:*" /> </bindings> </site>
答
如果你开始你的项目从Visual Studio调试,有对ApplicationHost.config将在其他目录中使用驻留。 不幸的是,此文件的更改会干扰Visual Studio。目前,我只有在之后更改文件时才使用它,然后在VS中打开项目并将其恢复到它的旧阶段,然后再次在VS中打开项目。
您可以在您的项目根目录下的.vs \ config \ applicationhost.config中找到它。
在那里,你会发现 - 块,在那里你可以用*
<bindings>
<binding protocol="http" bindingInformation="*:50216:*" />
</bindings>
您还需要添加一个净ACL
netsh http add urlacl url=http://localhost:50216/ user="NT AUTHORITY\INTERACTIVE"
netsh http add urlacl url=http://*:50216/ user="NT AUTHORITY\INTERACTIVE"
本地主机更换