Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Msmq and WCF Service

I have created a WCF service using the NetMsmq binding for which i created a private queue on my machine and executed the project. This works fine as such and my WCF service is started and accesses the message using the queue in the debugging environment. Now, I wanted to host the service using the windows service and for the same I created a new project and windows installer as well (This service runs under Local System Account). Then I tried installing this windows service using the InstallUtil command through the command prompt. When installation is happening and during the service host opening, I get an exception saying:

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)

Could anyone suggest the possible solution for the above issue? Am I missing any permissions to be set for the queue as well as the windows service, if so could you suggest where should these permissions be added?

like image 299
Sowmya Avatar asked Jan 28 '10 13:01

Sowmya


People also ask

What service is MSMQ?

MSMQ(Microsoft Message Queuing) provides a distributed and decoupled way of sending and receiving messages between applications. MSMQ acts as a queue manager that easily decides when applications should be isolated and work even if other applications they interact with are down or unavailable.

Is MSMQ still supported?

As a Windows component, MSMQ is technically “supported” as long as it's carried by a supported version of Windows. Since it exists in Windows 10 and Windows Server 2019, MSMQ will continue to live on until at least 2029—and much longer assuming it isn't removed from future versions of Windows.

Which is the correct MSMQ address format in WCF?

MSMQ AddressA fully qualified domain name of the machine running MSMQ or localhost. [private] is optional, but when used it contains the address of a target queue that is private queue. Queue-name is the name of the MSMQ name.

What does MSMQ stand for?

Microsoft Message Queuing (MSMQ) is a message queue implementation developed by Microsoft and deployed in its Windows Server operating systems since Windows NT 4 and Windows 95.


2 Answers

Tom Hollander had a great three-part blog series on using MSMQ from WCF - well worth checking out!

  • MSMQ, WCF and IIS: Getting them to play nice (Part 1)
  • MSMQ, WCF and IIS: Getting them to play nice (Part 2)
  • MSMQ, WCF and IIS: Getting them to play nice (Part 3)

Maybe you'll find the solution to your problem mentioned somewhere!

like image 188
marc_s Avatar answered Sep 19 '22 22:09

marc_s


Yes, it looks like a permissions issue.

Right click on your private queue from the Server Manager, and select Properties. Proceed to the Security tab, and make sure you have the right permissions in there for your Local System Account.

This is also confirmed in Nicholas Allen's article: Diagnosing Common Queue Errors, where the author defines the error code 0xC00E0025 as a permissions problem.

like image 33
Daniel Vassallo Avatar answered Sep 19 '22 22:09

Daniel Vassallo