使用netsh命令导致VS调试无法连接配置服务器

来源:互联网 发布:苏州住宅成交数据 编辑:程序博客网 时间:2024/04/30 00:32
在VS调试站点,默认使用IISExpress,locall+端口,为了使用IP地址、多域名调试,找到


IISExpress下的applicationhost.config,在目标站点下增加类似行:

[html] view plaincopy
  1. <binding protocol="http" bindingInformation="*:51000:192.168.1.10" />  

变成

[html] view plaincopy
  1. <binding protocol="http" bindingInformation="*:51000:localhost" />  
  2. <binding protocol="http" bindingInformation="*:51000:192.168.1.10" />  


通过IP地址访问时可能出现400错误,管理员权限打开CMD,输入:

[html] view plaincopy
  1. netsh http add urlacl url=http://192.168.1.10:51000/ user=everyone  

本来好好的,结果手贱,又输入一个:

[html] view plaincopy
  1. netsh http add urlacl url=http://127.0.0.1:51000/ user=everyone  

由于一直用192那个调试,没发现问题,后来发现VS不能调试了,提示无法连接配置服务器,打开其它项目却能调试,怀疑到端口占用,然后寻到上述命令,输入下面两句,均报错误:

[html] view plaincopy
  1. netsh http delete urlacl url=http://127.0.0.1:51000/ user=everyone  

[html] view plaincopy
  1. netsh http delete urlacl url=http://127.0.0.1:51000  

上网搜,都没有找到相应方法,突然尝试打入:

[html] view plaincopy
  1. netsh http delete urlacl url=http://127.0.0.1:51000/  

顺利执行,打开VS调试,回复正常,唉,原来少打了个“/”

0 0