I’ve been having endless woes trying to deploy an NServiceBus application that I had suspected were due to legacy code / application pool issues, so today I’ve set up a completely clean VM with Windows 7 x64 (SP1), installed Visual Studio 2008 and the latest [NServiceBus 2.6.1504][1] binaries, and I’m seeing exactly the same problem. I’ve unblocked the ZIP file, done the RunMeFirst.bat thing, and I’m using the .NET 3.5 AsyncPages example supplied with NServiceBus to reproduce the issue.
Firstly, when I run both the server and the WebApplication1 example under Visual Studio, it works fine.
The problem occurs when I try to run the WebApplication1 example under IIS. All I’ve done is to go into IIS Manager, right-click the default web site, and change the physical directory to the WebApplication1 folder in the NServiceBus distro.
The default.aspx page loads OK and displays:
Enter a number below and click “Go”.
If the number is even, the result will be “Fail”, otherwise it will be “None”.
…but when I enter any kind of input and click “Go”, it all goes wrong.
The NServiceBus.host.exe process that’s running the server produces the output:
2011-09-19 00:31:23,623 [Worker.5] INFO NServiceBus.Unicast.UnicastBus [(null)]
<(null)> – Received message Messages.Command, Messages, Version=1.0.0.0, Cultur
e=neutral, PublicKeyToken=null with ID 77ae75b7-ffad-4025-8163-13a83c60db91\41 f
rom sender MyWebClient@WIN7-VM2011-09-19 00:31:23,632 [Worker.5] INFO NServiceBus.Unicast.UnicastBus [(null)]
<(null)> – Can’t impersonate because no windows identity specified in incoming
message. This is common in interop scenarios.
(this is all in green which suggests it’s not anything to worry about…?)
Then I get two messages in the Windows event log:
Log Name: System
Source: Microsoft-Windows-WAS
Date: 19/09/2011 00:31:20
Event ID: 5011
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: Win7-VM
Description: A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was '3360'. The data field contains the error number.
There’s then another identical message with a different process id, and then I get The connection to **localhost** was interrupted.
Hitting “Refresh” just produces exactly the same behaviour – two NServiceBus log messages, two errors in the Windows event log, and then the “connection interrupted” message.
This is a completely clean install, running binaries straight off the NServiceBus site, so I’m at a loss as to why it’s not working – have I stumbled across an unsupported scenario or something? Any help much appreciated.
OK… it appears this is due to message queue permissions.
I found this post from Jonathan Oliver, which addresses exactly the issue I’m experiencing, and links to this post which goes into more detail about what’s causing it.
Long story short – if the account that’s running your web app doesn’t have permission to write to the message queue, the w3wp.exe just crashes. Which really sucks as a diagnostic aid, but that’s just how it is.
Message queue permissions in Windows 7 are managed via Computer Management -> Services and Applications -> Message Queueing; I found the appropriate queue, gave the IIS Application Pool’s user (NETWORK SERVICE) “full control”, and restarted both IIS and the NServiceBus server host, and suddenly everything started working.