更改WCF基地址

Abh*_*bhi 5 wcf

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

http://localhost:8732/Design_Time_Addresses/evalservice
Run Code Online (Sandbox Code Playgroud)

但是当我删除Design_Time_Addresses并寻找一个简单的基地址时,如下所示

<add baseAddress="http://localhost:8732/evalservice" />
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

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
Run Code Online (Sandbox Code Playgroud)

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

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

nod*_*ots 7

.NET框架自动注册 Design_Time_Addresses命名空间,以允许没有管理员权限的用户开发WCF服务:

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

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

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