开发者

Windows service won't start when using other credentials from active directory

I have created a windows service. The OnStart method only exists of a 开发者_开发百科Timer setup:

Timer startupTimer = new Timer();

protected override void OnStart(string[] args)
{
  startupTimer.Elapsed += new ElapsedEventHandler(startupTimer_Elapsed);
  startupTimer.Interval = 60000;
  startupTimer.Enabled = true;
  startupTimer.AutoReset = false;
}

When I install the service, and run it directly (log on as: 'Local System Account') it works perfectly, it starts within 2 seconds. But, the service needs to acces a network share with special permissions. Therefore I setup 'Log on as: [domain\user-account]'. When I then start the service, it takes more than 30 seconds and I receive the following error message: The service did not respond to the start or control request in a timely fasion.

Searching for this error gives a lot of solutions, but (as far as I googled) never related to different credentials. I doubt that setting the time-out value from 30 seconds to 60 seconds will help, because the OnStart code is very small. Also, it's a production server which I can't reboot just to try another TimeOut setting in the registry.

Does someone has any ideas/suggestions for me?

Many thanks in advance!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜