Tuesday, April 5, 2011

Debugging successful but service not working after installation.

I used the following piece of code in the service to debug the service successfully by running the service as a console application and verified everything works fine.But later when I installed the service and started it as a windows application the service is running as indicated by the services console but it is not doing the job it has to.I want to know what went wrong in this scenario.Thanks.

static void Main() { System.ServiceProcess.ServiceBase[] ServicesToRun;

        if (Environment.UserInteractive)
        {
            ListenerSVC service = new ListenerSVC();
            service.OnStart(null);
            Console.WriteLine("Press any key to stop program");
            Console.Read();
            service.OnStop();
        }
        else
        {

            ServicesToRun = new System.ServiceProcess.ServiceBase[] { new ListenerSVC() };
            ServiceBase.Run(ServicesToRun);


        }
 }
From stackoverflow
  • Have you tried catching/logging any exceptions? The most likely cause is security (i.e. the service account not having access to some resource). There is also often an isue locating the .config file for a service (watch that if you are using config). Finally, for simplicity, try using a command arg just in case UserInteractive is reporting incorrectly - I tend to use "-c" for console/debug mode.

    kjayakum : I am logging status into the database and yes it says 'Access to Message Queuing System Denied'. I am trying to read messages from a private queue in my system using a listener service.
    kjayakum : I have turned off UAC and I have also added application manifest to elevate privileges. I am not aware of security needs specific to the message queuing system. I checked the message queue properties and I find that the security tab does not display any settings for running in WORKGROUP mode.

0 comments:

Post a Comment