[英]WCF Remote MSMQ - I can write to a remote queue, but cannot receive
jobsServer:Windows Server 2008 R2 .NET版本:4.5
我正在使用WCF連接兩個服務器 - 應用程序和隊列 。 我希望應用程序能夠從隊列發送/接收消息。 出於某種原因,應用程序可以發送消息,但無法接收消息。
netMsmq綁定看起來像:
<binding name="JobExecutionerBinding" receiveErrorHandling="Move">
<security>
<transport msmqAuthenticationMode="None" msmqProtectionLevel="None" />
</security>
</binding>
服務綁定看起來像:
現在,客戶端綁定看起來像:
<endpoint address="net.msmq://queue/private/jobs"
binding="netMsmqBinding"
bindingConfiguration="JobExecutionerBinding"
contract="JobExecution.Common.IJobExecutionService"
name="SimpleEmailService"
kind=""
endpointConfiguration=""/>
為安全起見,我改了幾個名字。
因此,WC客戶端可以毫無問題地發送到遠程隊列。 它甚至可以正確排隊傳出的消息,並在遠程隊列服務器關閉的情況下稍后將其轉發。 但是每次啟動WCF服務時,我都會得到:
打開隊列時出錯。 確保MSMQ已安裝並正在運行,隊列存在並具有可從中讀取的適當權限。 內部異常可能包含其他信息。 ---> System.ServiceModel.MsmqException:打開隊列時發生錯誤:隊列不存在或您沒有足夠的權限來執行操作。 (-1072824317,0xc00e0003)。 無法從隊列中發送或接收消息。 確保已安裝並運行MSMQ。 還要確保可以使用所需的訪問模式和授權打開隊列。 System.ServiceModel.Channels.MsmqQueue.OpenQueue()at System.ServiceModel.Channels.MsmqQueue.GetHandle()at System.ServiceModel.Channels.MsmqQueue.SupportsAccessMode(String formatName,Int32 accessType,MsmqException&msmqException)---內部結束異步堆棧跟蹤--- System.ServiceModel.Channels.MsmqVerifier.VerifyReceiver(MsmqReceiveParameters receiveParameters,Uri listenUri)位於System.ServiceModel.Channels.Binding.BuildChannelListener的System.ServiceModel.Channels.MsmqTransportBindingElement.BuildChannelListener [TChannel](BindingContext context)處System.ServiceModel.Description.DispatcherBuilder.MaybeCreateListener中的[TChannel](Uri listenUriBaseAddress,String listenUriRelativeAddress,ListenUriMode listenUriMode,BindingParameterCollection參數)(Boolean actualCreate,Type [] supportedChannels,Binding binding,BindingParameterCollection參數,Uri listenUriBaseAddress,String listenUriRelativeAddress,ListenUriMode listenUriMode, ServiceThrottle油門, IChannelListener&result,Boolean supportContextSession)at System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff,ServiceHostBase serviceHost,Uri listenUri,ListenUriMode listenUriMode,Boolean supportContextSession,IChannelListener&result)at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description,ServiceHostBase) service.ServiceModel.ServiceHostBase.InitializeRuntime()at at ServiceHost)
我已經在StackOverflow和互聯網上待了8個小時。 這就是我所做的:
救命!!! 沒有遠程排隊解決方案,我無法擴展我的應用程序。
從您的帖子中不清楚哪個層無法讀取 ,更重要的是哪個隊列 。
但是,不支持以事務方式讀取遠程隊列:
消息隊列支持將事務性消息發送到遠程隊列, 但不支持從事務中的遠程隊列中讀取消息 。 這意味着遠程隊列無法提供可靠,准確的一次接收。 請參閱從遠程隊列中讀取消息
我懷疑你的系統仍在執行事務性遠程讀取的某個地方,即使你提到你禁用了它。
從最佳實踐的角度來看,即使你讓它發揮作用,你的設計也不會擴展,因為它是你提到的你想要的東西。
遠程讀取是一個高開銷,因此效率低下的過程。 在應用程序中包括遠程讀取操作會限制擴展。 1
你應該總是遠程寫 不遠程讀。
更好的方法是插入消息代理或路由器服務 ,作為消息傳遞的中心點。 您的應用程序和隊列服務(順便說一句令人困惑的名稱)應該只是從其本地隊列中以事務方式讀取 。
即
同樣,如果您的隊列層想要回復,則會發生上述相反的過程。
稍后,如果您希望提高性能,可以引入動態路由器 ,該路由器根據動態規則集或環境條件(如壓力級別)將消息重定向到另一台計算機上的其他遠程隊列。
從MSMQ 4.0(Windows Server 2008)開始支持遠程事務讀取。 如果您遇到此問題,請務必查看https://msdn.microsoft.com/en-us/library/ms700128(v=vs.85).aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.