HTTP could not register URL http://+:8000/testservice/. Your...

今天继续调试WCF Web API源代码,方向是跟踪其单元测试,结果一上手就出了一个错误:

 

HTTP could not register URL http://+:8000/testservice/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

 

 

经过一番好找,才知道是由于在Vista和Win7中的安全设置引起的,使用"netsh.exe"命令可以将http://+:8000/testservice添加到安全设置中,方法如下:

 

netsh http add urlacl url=http://+:8000/ user=DOMAIN\UserName

 

但看到这里,我是不想使用Dos命令,感觉和配路由器一样,太复杂了,正在这时,一个工具映入眼帘:HttpNamespaceManager

 

如图:

 

 

使用这个工具,就可以很快将HttpNamespace添加到安全配置中了,将http://+:8000/testservice添加后,异常果然消除了。

posted @ 2012-08-07 10:58  Sphix  阅读(2648)  评论(2编辑  收藏  举报