I have a WinService that can't start because NServiceBus throws "Service cannot be started. System.Messaging.MessageQueueException (0x80004005): Access to Message Queuing system is denied."
This is on Windows 7
I have tried to run the service as: LocalSystem, Localservice, and NetworkService
here is how I'm setting up NServiceBus
private static IBus _serviceBus;
private static AuditMessageHandler _messageHandler;
public AuditQueueProcessor()
{
_messageHandler = new AuditMessageHandler();
_serviceBus = Configure.With()
.Log4Net()
.DefaultBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(true)
.PurgeOnStartup(false)
.UnicastBus()
.ImpersonateSender(false)
.LoadMessageHandlers()
.CreateBus()
.Start();
}
here is my Config
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core"/>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
</configSections>
<MsmqTransportConfig InputQueue="LoggerInputQueue" ErrorQueue="LoggerInputError" NumberOfWorkerThreads="1" MaxRetries="5"/>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="Truckstop2.Imports.Objects.AuditMessage,Truckstop2.Imports.Objects" Endpoint="InputQueue@newimp001" />
</MessageEndpointMappings>
</UnicastBusConfig>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>