无法加载DLL'mqrt.dll'

ETF*_*fax 12 dll wcf msmq windows-server-2008

我开发了一个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)
Run Code Online (Sandbox Code Playgroud)

SERVER1和SERVER2都运行Windows Server 2008 R2 Enterprise(6.1 SP1),并且都通过服务器管理器中的添加功能安装了MSMQ.

我知道DLL丢失了(从错误中显而易见!),但我不知道我应该安装什么来获取它应该是的dll.

在Windows资源管理器中搜索显示DLL存在于两个服务器上的以下目录中....

  • C:\ Windows\System32下
  • C:\ WINDOWS\SysWOW64中
  • C:\ WINDOWS\winsxs文件\窗口是X86_microsoft - MSMQ运行时,core_31bf3856ad364e35_6.1.7601.17514_none_5768e2ad17453bd6
  • C:\ WINDOWS\winsxs文件\ Amd64_microsoft窗口 - MSMQ运行时,core_31bf3856ad364e35_6.1.7601.17514_none_b3877e30cfa2ad0c

任何帮助赞赏.

SCh*_*ice 22

显而易见; 如果您没有安装Windows功能 - > Microsoft消息队列(MSMQ)服务器,则会出现此错误.只需转到" 程序和功能",然后打开或关闭"打开Windows功能".


ETF*_*fax 5

我不是更聪明,但事情现在正在发挥作用.

在SO和谷歌上工作了几个小时之后,我最后只是通过编写一个快速控制台应用程序来检查MSMQ是否安装在两个服务器上,从这里抓取代码......

/sf/answers/1127294871/

我在Server1和Server2上运行了控制台应用程序,两者都返回了True到IsMsmqInstalled的结果.

然后我运行我的应用程序并且"无法加载DLL'mqrt.dll'"错误不再被引发.

我不知道是否调用了NativeMethods.LoadLibrary("Mqrt.dll");注册DLL或其他东西,但它肯定解决了我的问题.

我希望这有助于将来的某个人!