[英]Unable to load DLL 'mqrt.dll'
我開發了一個WCF服務,它作為Windows服務托管並公開了一個MSMQ端點。
我在SERVER1上有客戶端應用程序,在SERVER2上有MSMQ和WCF服務。
當SERVER1 / ClientApp嘗試將消息推送到SERVER2 MSMQ時,我得到以下錯誤:
System.TypeInitializationException: The type initializer for 'System.ServiceModel.Channels.Msmq' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'mqrt.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.ServiceModel.Channels.UnsafeNativeMethods.MQGetPrivateComputerInformation(String computerName, IntPtr properties)
at System.ServiceModel.Channels.MsmqQueue.GetMsmqInformation(Version& version, Boolean& activeDirectoryEnabled)
at System.ServiceModel.Channels.Msmq..cctor()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.Msmq.EnterXPSendLock(Boolean& lockHeld, ProtectionLevel protectionLevel)
at System.ServiceModel.Channels.MsmqOutputChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [7]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FacilityManager.Service.NotificationsProcessorServiceReference.INotificationsProcessor.SendNewReactiveTaskNotifications(NewReactiveTaskDataContract newReactiveTaskDataContract)
SERVER1和SERVER2都運行Windows Server 2008 R2 Enterprise(6.1 SP1),並且都通過服務器管理器中的添加功能安裝了MSMQ。
我知道DLL丟失了(從錯誤中顯而易見!),但我不知道我應該安裝什么來獲取它應該是的dll。
在Windows資源管理器中搜索顯示DLL存在於兩個服務器上的以下目錄中....
任何幫助贊賞。
顯而易見; 如果您沒有安裝Windows功能 - > Microsoft消息隊列(MSMQ)服務器 ,則會出現此錯誤。 只需轉到“ 程序和功能” ,然后打開或關閉“打開Windows功能” 。
我不是更聰明,但事情現在正在發揮作用。
在SO和谷歌上工作了幾個小時之后,我最后只是通過編寫一個快速控制台應用程序來檢查MSMQ是否安裝在兩個服務器上,從這里抓取代碼......
https://stackoverflow.com/a/16104212/192999
我在Server1和Server2上運行了控制台應用程序,兩者都返回了True到IsMsmqInstalled的結果。
然后我運行我的應用程序並且“無法加載DLL'mqrt.dll'”錯誤不再被引發。
我不知道是否調用NativeMethods.LoadLibrary("Mqrt.dll");
注冊了DLL或其他東西,但它肯定解決了我的問題。
我希望這有助於將來的某個人!
這可能是由於SERVER2上的服務啟動並在MSMQ初始化之前完成初始化。 測試此方法的最簡單方法是重新啟動托管WCF MSMQ端點的服務。 如果WCF服務托管在IIS中,也許彈出應用程序池也會做同樣的事情,但我不確定 - 我從未處理過IIS托管的MSMQ端點。
如果重新啟動服務可以修復您的問題並且您自己的服務是Windows服務,那么您可以將MSMQ作為依賴項添加到您自己的服務中,這樣它就會延遲啟動,直到MSMQ准備就緒。 這對服務器故障的回答說明如何做到這一點。 順便提一下,您想要依賴的服務稱為“消息隊列”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.