I am creating a windows service that will allow me to monitor a Message Queue. I have previously written a windows application that runs, with a form, and monitors the queue for incoming messages. This works perfect. In the form_load I create a queue and add a handler for the queue's ReceiveCompleted method. In the handler, I call the EndReceive, pull off the message and call BeginReceive. All works well.
I do not want this to run an exe with a GUI (the form) on our production box. I also want this to automatically start on a box reboot. So, I thought a windows service would be the perfect solution. Well, the service starts and when it gets to the code that starts working with the queue, I get the following error: Event Type: Error Event Source: Service1 Event Category: None Event ID: 0 Date: 7/30/2002 Time: 3:34:03 PM User: N/A Computer: US20207014 Description: Service cannot be started. System.Messaging.MessageQueueException: Access to Message Queuing system is denied. at System.Messaging.MQCacheableInfo.get_ReadHandle() at System.Messaging.MessageQueue.ReceiveAsync(TimeSpan timeout, Int32 action, AsyncCallback callback, Object stateObject) at System.Messaging.MessageQueue.BeginReceive() at QueueListener.NewQueue.StartListening() in C: \QueueListener\CAMSQueueListener.vb:line 108 at QueueListener.Service1.OnStart(String[] args) in C: \QueueListener\CAMSQueueListener.vb:line 70 at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state) This, to me sounds like a security issue. So, I switched the Account to User in the ProjectInstaller.vb file and tried to re-install the service. It prompts me to login while doing the install. I log in as the admin and the install fails and does a rollback. Any suggestions? You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.