Debugging Topshelf service that won't run under a restrictive account

I have a windows service written with Topshelf . I am trying to configure it to run using a limited Windows account and not using LocalSystem. This is also required as I would like to connect to the database using Integrated Authentication.

The service runs when started as LocalSystem (albeit with a database connection string containing the credentials) and starts a console app since my restricted account (using runas) also works.

However, when I try to start the service, the Service Control Manager expects a response:

The service did not respond to the start or control request in a timely manner.

I also get the following in the popup event log:

Application Error: An unknown software exception (0xc06d007e) occurred in the application at location 0x77e4bef7.

The first thing the application does is write to the log file, but it doesn't reach that when I start the service. The recording is done if I start the console.

Any suggestions on what I might be missing or what I can try next?

+2


source to share


3 answers


This issue seems to be related to the server (domain controller) and not TopShelf. A service built with a .NET service component also exhibits the same behavior.

The service starts successfully on another computer (in the same domain).



Unfortunately it doesn't help diagnose the problem, but it does give me an acceptable workaround.

+2


source


Check out the MSDN article Debugging Service Windows which describes how to debug service windows.



0


source


I've just started to see this on several of my services written in .net 2.0. They will start working fine when the server boots up, but if I were to restart them within a day they would not start and provide this error message.

They are currently running under a domain account that has admin rights to the box, but for kicks, I switched it to the local system and the service started fine. I stopped it, changed it back to a domain account (re-entering the password) and it started fine again as expected.

Not sure if this counts as a "fix", but that's what worked for me.

0


source







All Articles