MSMQ Activation does not work
Hi,
I've developed several WCF services using netMsmqBinding. When receiving new messages from the service client, the server-side service does not automatically start. In order to start the service, I need to open a browser and open the service help-page or WSDL. I've configured the hosting environment (WAS, IIS7, Vista) according to the documentation:
1. The WCF service is using an application pool running under a specific user account.
2. The Net.Msmq Listener Adapter service is running under the same user account.
3. The related MSMQ queues provides Full access for the user account.
4. The Net.Msmq Listener Adapter service is running using unrestricted token (command: sc sidtype netmsmqactivator unrestricted)
Regards
Henny
[1193 byte] By [
Henny] at [2007-12-30]
Could you make sure the following step is done on your Server machine?
The MSMQ activation service runs as Network Service by default. Therefore, the queue that is used to activate the application must have receive and peek permissions for Network Service. This can be added by using the Message Queuing MMC:
Run Compmgmt.msc.
Under Services and Applications, expand Message Queuing.
Click Private Queues.
Right-click the queue (servicemodelsamples/Service.svc) and choose Properties.
On the Security tab, click Add and give peek and receive permissions to Network Service
See if this will help.
Thanks.
Hi, thanks for your suggestion.
However, I've tried running using Network Service, a custom user account and even Administrator. Also, I've followed your suggestion and given Network Service, Administrators and Everyone full access.
Still no change.
Do you know if there is any system log which would contain some more information?
Regards
Henny
When server side failed to launch, what error message are you seeing in the event viewer?
Hi,
there is no information in the event viewer related to the server side failed to launch. It is as if nothing is happening.
Regards
Ottar
The user you are using, is it a domain or local user? If it is a local user, there might be additional step you have to do.
You can enable tracing the usual way by adding SMSvcHost as the source(something like below). But make sure the user has write permissions to the directory you choose to write the traces.
<system.diagnostics>
<sources>
<source name="SMSvcHost" switchValue="Warning">
<listeners>
<add name="e2e" />
</listeners>
</source>
...
You can also enable worker process tracing by adding this in web.config file:
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" propagateActivity="true" >
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="W3wp.e2e" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
These two trace files usually point you in the right direction.
Hi,
thanks for your tip. I've added the tracing and analyzed the trace output. Here is what happens:
1) My external web service client calls a WCF service, named A.
2) The IIS/WAS application pool starts automatically, starts the service host for WCF service A and handles the incoming request from the client.
3) WCF service A is implemented to act as a client of a one-way service, named B. WCF service A calls service B successfully.
Using MSMQ explorer I can now see a message on the queue associated with WCF service B. However, the service host for service B is never started. When I start the service B manually by accessing the services WSDL (or help page) all messages on the queue is processed. There is no information in the trace related to WCF service B.
My hosting environement
I'm running Vista Ultimate in a workgroup configuration (no domain) using local user accounts.
- Do I need to manually start the service host for MSMQ based services? Or should it actually start automatically as I believe?
Regards
Henny
Since you are in workgroup mode, please try after setting the following Registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\Security\AllowNonauthenticatedRPC
Type: REG_DWORD
Value= 1
You shouldn't have to start services as the activation service starts automatically, but it checks for messages every 10 minutes, so make sure you give it some time. But also you can restart the service to make it check for messages immediately instead of waiting for 10min.
Hi,
I've previously tried both with and without "AllowNonauthenticated RPC" configured. I've changed the value using the Message Queue administration console (Message Queuing | Properties | Disable un-authenticated RPC calls.
I've verified that hte Registry key was set to Value = 1.
Still nothing happens (even after a long time > 30 minutes) :-)
When you try to access the help page from a browser, you said the message is consumed. Can you check in TaskManager what user the w3wp.exe process is running as? Also can you double check what account the NetMsmqActivator service is using?
This same configuration has worked for me in the past...so I am trying to check what might be the problem here.
Also in the traces can you check what address it is trying to activate? Does it look like the right path is being used? Or can you please post some of the relevant info from the traces so I can take a look?
Hi,
1) The w3wp.exe process is running under NETWORK SERVICE user.
2) The Net.Msmq Listener Adapter service is running under Network Service user. (However, the other Listener Adapters are running under Local Service, including Net.Tcp Port Sharing,Net.Tcp and Net.Pipe. The Windows Process Activation Service is running under Local System).
3) NETWORK SERVICE user is allowed to Receive, Peek and Send from the queue.
I believe my problem is related to the name of the queues and the configured net.msmq:// URI's of the service. Can you verify that I'm using correct naming here?
My queue name (label) is: ottar-pc\private$\business/createtx
My service address URI is: net.msmq://localhost/private/business/createtx
The problem with the traces is that I can't see any information related to activation of the service. The only information I can see is the service publishing to the queue.
I really appreciate your assistance.
Regards
Henny
I thought the setup was using a specific user to run the NetMsmqActivator and also the worker process in DefaultAppPool. That is the configuration that works in workgroup mode. And I am assuming the queue is located on a remote machine to where the service is, is that correct?
Also the queue name should contain the service name. something like: ottar-pc\private$\business/createtx/service.svc
Thanks, you pointed me in the right direction. During the troubleshooting I've changed different configuration parameters, until you pointed to the queue name vs. service endpoint name. The problem was that I left out the service.svc from the queue and endpoint name.
Here is my successful check-list for using WAS and MSMQ for one-way WCF services:
1) Create a queue (mark it as transaction if durable and exactlyOnce is set to true) and name if /virtualpath/service.svc (ex. /test/sample/service.svc)
2) Set the service endpoint address (both on the server and client) to net.msmq://localhost/private/test/sample/service.svc)
3) Make sure that the Net.Msmq Listener Adapter and IIS/WAS working process uses the same user account (by default, Network Service)
4) Make sure the user account defined in previously step is allowed to Receive and Peek from the queue created in step 1)
My configuration:
Single PC running Vista Ultimate and MSMQ running in Workgroup Mode. No domain controllers involved.
Regards
Ottar
Glad to know it is finally working for you...