2009-12-28 95 views
2

当移动到Windows 7平台上的WCF调用从ASP.NET项目抛出异常Windows 7和WCF

ex {"HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."} System.Exception {System.ServiceModel.AddressAccessDeniedException} 

+ [System.ServiceModel.AddressAccessDeniedException] {"HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."} System.ServiceModel.AddressAccessDeniedException 

+ InnerException {"Access is denied"} System.Exception {System.Net.HttpListenerException} 
    Message "HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)." string 
    Source "System.ServiceModel" string 

+ TargetSite {Void OnOpen()} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo} 

回答

3

确定从出站呼叫这是?当您尝试打开W​​CF“服务器”进行收听时,这是您在Windows 7(以及Vista和Windows 2008)上遇到的错误。如果您尝试在未注册的情况下创建端点,则会发生这种情况。在客户端,如果它的双工服务,当然客户端需要打开端点,则可能发生这种情况。

链接到异常的KB article有关于如何注册端点的说明。基本上你可以在提升的命令提示符下运行以下命令。

netsh http add urlacl url=//+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/ user=DOMAIN\Network Service 

将DOMAIN替换为您的机器名称,它应该适合您的机器。

+0

我很习惯于忽略这些例外情况下的链接,我甚至都没有考虑过这种情况。你的例子对我很好(除非我无法接受网络服务,所以我用我自己)。但是,我必须为我希望托管服务的每个端口执行此操作,这真是一种耻辱。 – Ecyrb 2009-12-28 18:36:49

+0

那么你可以做的是保留一个前缀并保留一些类似于// + 9100/Ecyrb /的内容,然后将每个服务放在该端口/ Ecryrb上,例如http:// localhost:9100/Ecyrb/Service1.svc /和http:// localhost:9100/Ecyrb/Service2.svc / – blowdart 2009-12-28 19:09:49

2

好吧,如果你按照例外中包含的the link,并阅读它说你有答案。运行命令:“开始以管理员身份”

netsh http add iplisten ipaddress=0.0.0.0:9100 
0

我有这个问题调试我的web服务在Visual Studio 2010 我解决我的问题,推出Visual Studio 2010中使用