1
votes

I'm using NserviceBus 2.0 with pub/sub mode. My subscribers are installed as a windows service. However after computer restart I always get the following problem in log : "Problem in peeking a message from queue: ServiceNotAvailable".

After digging into source code I found that this is NserviceBus custom error and it occurs in MsmqTransport class. It seems like my subscriber's service is started before Msmq service. Bus this should be impossible because subscriber's service has Msmq as dependency.

After some time service is starting and working correctly. But I have several megabytes of errors in log. And sometimes service is not even starting.

Can anyone help me? I'm using Windows 7. Msmq is installed with NserviceBus utils.

2

2 Answers

1
votes

You need to configure your service to be dependent on the MSMQ service. This is should be automatically taken care of if you're using the NServiceBus host.

Installing a Windows Service with dependencies

0
votes

Have seen the same problem. Actually the impact was even worse since we used log4net and SmtpAppender. Took down the mailserver, ouch! Seems like this is fixed in NSB 3. It sets number of workerthreads to zero and logs "please reboot service". You can even execute own code when the error occurs. Config with lambda using OnCriticalError. We ended up patching the NSB 2 code, since we havent upgraded to NSB 3 yet. Handling MSMQExceptions, logging and stopping the process on errorcode ServiceNotAvailable like they already do when you don't have correct rights to queue. You should probably stop the service on any MSMQExceptions exept IOTimeout.