Failed to load dll 'mqrt.dll'

I developed the WCF service, which is hosted as a Windows service and provides an MSMQ endpoint.

I have a client application on SERVER1, and the MSMQ and WCF service on SERVER2.

When SERVER1 / ClientApp tries to send a message to the SERVER2 MSMQ server, I get the following error message:

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) 

Both SERVER1 and SERVER2 are running Windows Server 2008 R2 Enterprise (6.1 SP1), and both have MSMQ installed by adding features in Server Manager.

I understand that the DLL is missing (pretty obvious from the error!), But I have no idea what I need to install in order to get the DLL where it should be.

A search in Windows Explorer shows that the DLL is present in the following directories on both servers ....

  • C: \ Windows \ System32
  • C: \ Windows \ SysWOW64
  • C: \ Windows \ WinSxS \ x86_Microsoft-windows-MSMQ-environment-core_31bf3856ad364e35_6.1.7601.17514_none_5768e2ad17453bd6
  • C: \ Windows \ WinSxS \ amd64_microsoft-windows-MSMQ-environment-core_31bf3856ad364e35_6.1.7601.17514_none_b3877e30cfa2ad0c

Any help was appreciated.

+7
dll windows-server-2008 wcf msmq
source share
3 answers

I'm not wiser, but now everything works.

After hours of working with SO and Google, I decided to verify that MSMQ was installed on both servers by writing a quick console application with the code captured here ...

stack overflow

I ran a console application on Server1 and Server2, and both returned with the result True to IsMsmqInstalled.

Then I launched my application, and the error "Failed to load DLL" mqrt.dll "no longer raised.

I don't know if the call to NativeMethods.LoadLibrary("Mqrt.dll"); registered NativeMethods.LoadLibrary("Mqrt.dll"); DLL or something else, but that certainly fixed my problem.

I hope this helps someone in the future!

+4
source share

The obvious aside; If you do not have Windows → Microsoft Message Queue (MSMQ) Server installed, you will receive this error. Just go to Programs and Features , and then turn Windows feature on or off .

+16
source share

This may be caused by your service when starting SERVER2 and completing its initialization before MSMQ is initialized. The easiest way to verify this is to restart the service on which the WCF MSMQ endpoint is installed. If the WCF service is hosted in IIS, it is possible that bouncing the application pool will do the same, but I do not know for sure - I have never dealt with an MSMQ endpoint hosted in IIS.

If restarting the service solves your problem, and your own service is a Windows service, you can add MSMQ depending on your own service so that it delays its launch until MSMQ is ready. This server error response describes how to do this. By the way, the service you want to depend on is called "Message Queuing"

+1
source share

All Articles