更改WCF基地址

时间:2015-04-15 17:01:33

标签: wcf

默认情况下,我的测试wcf应用程序的基地址是

http://localhost:8732/Design_Time_Addresses/evalservice

但当我删除Design_Time_Addresses并寻找一个简单的基地址如下

<add baseAddress="http://localhost:8732/evalservice" />

我收到以下错误

Please try changing the HTTP port to 8732 or running as Administrator.
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8732/evalservice/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

当我将其移回Design_Time_Addresses时,问题就解决了。

什么是Design_Time_Addresses以及如何将其更改为更简单的基址?

1 个答案:

答案 0 :(得分:7)

Design_Time_Addresses命名空间is automatically registered by the .NET framework to allow users without administrator privileges to develop WCF services

  

您可以使用提升的管理员帐户下的netsh.exe工具[...]修改访问权限。以下是使用netsh.exe的示例。

     

netsh http add urlacl url=http://+:9002/MyService user=<domain>\<user>

另一种解决方法是以管理员身份运行Visual Studio。