2009-12-28 94 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中使用