Archive for the ‘IIS7’ Category

Queued WCF Services, MSMQ, IIS7 and NetMsmqActivator. Oh My.


First of all; credits for this solution goes to a former colleague, and now a contractor working in my department; Erlend Rotvik of WebStep Fokus.

The title might be a bit cryptic, so let me elaborate a bit on the subject; until last week or so, it was “common knowledge” that using the NetMsmqActivator together with Queued WCF services hosted in different IIS7 sites was a no-go. The reason for this “truth” was that there wasn’t a way to specify how the NetMsmqActivator should dispatch messages to the different IIS sites.

If you experience exceptions like this one:


or get this one in your face unexpectedly:

you’ve probably being screwed by the NetMsmqActivator with wrong binding information set.

When you set up an net.msmq on your IIS7 site, the binding information you enter is normally localhost, so Erlend played a bit with the syntax and found out that if he used an asterisk (*) he could filter on specific queues. Since we prefix all MSMQ queues based on the project / services they belong to, he tried to put the prefix before the asterisk – and lo and behold; now the NetMsmqActivator only dispatched messages from the queues that matched the prefix! As far as I know, this isn’t documented, so head over to a local IIS7 installation of yours and try it out!

Example binding information:


would tell the NetMsmqDispatcher to only dispatch messages in queues named MySite.* to the given IIS Web Site.