簡體   English   中英

Msmq和WCF服務

[英]Msmq and WCF Service

我使用NetMsmq綁定創建了一個WCF服務,我在我的機器上創建了一個私有隊列並執行了該項目。 這樣工作正常,我的WCF服務啟動並使用調試環境中的隊列訪問消息。 現在,我想使用Windows服務托管服務,同樣我也創建了一個新項目和Windows安裝程序(此服務在本地系統帳戶下運行)。 然后我嘗試通過命令提示符使用InstallUtil命令安裝此Windows服務。 當安裝發生時和服務主機打開期間,我得到一個例外說:

There was an error opening the queue. Ensure that MSMQ is installed and running, the queue exists and has proper authorization to be read from. The inner exception may contain additional information. 
Inner Exception System.ServiceModel.MsmqException: An error occurred while opening the queue:Access is denied. (-1072824283, 0xc00e0025). The  message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that the queue is available to open with the required access mode and authorization.
   at System.ServiceModel.Channels.MsmqQueue.OpenQueue()
   at System.ServiceModel.Channels.MsmqQueue.GetHandle()
   at System.ServiceModel.Channels.MsmqQueue.SupportsAccessMode(String formatName, Int32 accessType, MsmqException& msmqException)

有誰能建議上述問題的可能解決方案? 我是否遺漏了為隊列和Windows服務設置的任何權限,如果是這樣,你能否建議在哪里添加這些權限?

湯姆·霍蘭德(Tom Hollander)有一個關於使用WCF的MSMQ的三部分博客系列 - 非常值得一試!

也許你會找到解決你某個地方提到的問題的方法!

是的,它看起來像權限問題。

右鍵單擊服務器管理器中的專用隊列,然后選擇“屬性”。 進入“安全”選項卡,確保您的本地系統帳戶具有正確的權限。

在Nicholas Allen的文章: 診斷常見隊列錯誤中也證實了這一點,其中作者將錯誤代碼0xC00E0025定義為權限問題。

我遇到了同樣的問題,這是解決方案。

右鍵單擊“我的電腦” - >管理。 在“計算機管理”窗口中,轉到“服務和應用程序 - >消息隊列 - >您的隊列”,選擇您的隊列和訪問屬性。 添加運行您的WCF應用程序的用戶並授予完全訪問權限。 這應該可以解決問題。

很簡單,服務無法找到它的隊列。 隊列名稱必須與端點地址完全匹配。

例:

net.msmq://localhost/private/wf.listener_srv/service.svc

指向本地隊列

私人$ \\ wf.listener_srv \\ service.svc

如果隊列名稱和端點彼此相互依賴,則最類似於IIS pool定義的憑據不授予對隊列的訪問權限。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM