调试不会在限制帐户下运行的 Topshelf 服务

发布于 2024-08-07 04:43:19 字数 583 浏览 7 评论 0原文

我有一个使用 Topshelf 编写的 Windows 服务。我正在尝试将其配置为使用具有受限权限的 Windows 帐户运行,而不是使用 LocalSystem。这也是必要的,因为我想使用集成身份验证连接到数据库。

该服务在作为 LocalSystem 运行(尽管使用包含凭据的数据库连接字符串)并作为我的有限帐户(使用 runas)运行控制台应用程序时工作。

但是,当我尝试启动服务时,服务控制管理器在等待响应时超时:

服务未及时响应启动或控制请求。

我还在应用程序弹出事件日志中收到以下内容:

应用程序错误:应用程序中位置 0x77e4bef7 处发生异常未知软件异常 (0xc06d007e)。

应用程序执行的第一件事是写入日志文件,但当我启动服务时它不会到达该文件。如果我通过控制台运行,则日志记录有效。

有什么建议我可能会错过什么或者我下一步可能会尝试什么吗?

I have a Windows service written using Topshelf. I'm trying to configure it to run using a Windows account with restricted privileges rather than using LocalSystem. That's also necessary as I'd like to connect to a database using integrated authentication.

The service works when run as LocalSystem (albeit with a database connection string containing credentials) and running the console application as my limited account (using runas) also works.

However, when I try to start the service the service control manager times out waiting for a response:

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

I also get the following in the Application Popup event log:

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

The first thing that the application does is writes to a log file but it doesn't reach that when I start the service. The logging works if I run via the console.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

属性 2024-08-14 04:43:19

这个问题似乎与服务器(域控制器)有关,而不是与 TopShelf 有关。使用 .NET 服务组件构建的服务也表现出相同的行为。

该服务在不同的计算机(同一域中)上成功运行。

不幸的是,这无助于诊断问题,但给了我一个可接受的解决方法。

This problem seems to be related to the server (a domain controller) rather than TopShelf. A service built with the .NET service component also exhibits the same behaviour.

The service runs successfully on a different machine (in the same domain).

Unfortunately this doesn't help diagnose the problem but gives me an acceptable workaround.

夏日落 2024-08-14 04:43:19

查看 MSDN 文章调试 Windows 服务,其中介绍了如何调试 Windows 服务。

Check the MSDN article Debugging windows services which describes how you debug windows services.

翻身的咸鱼 2024-08-14 04:43:19

我刚刚开始在一些用 .net 2.0 编写的服务中看到这一点。当服务器启动时,它们会正常启动,但如果我一整天重新启动它们,它们就不会启动,并给出此错误消息。

他们目前在一个具有管理员权限的域帐户下运行,但为了好玩,我将其切换到本地系统,并且服务正常启动。我停止了它,将其更改回域帐户(重新输入密码),并且它按预期再次正常启动。

不知道这是否算作“修复”,但这对我有用。

I've just started seeing this on a few of my services written in .net 2.0. They'll start fine when the server boots, but if I were to restart them throughout the day, they would not start, and give this error message.

They currently ran under a domain account which has admin rights on the box, but for kicks, I switched it to Local System, and the service started normally. I stopped it, changed it back to the domain account (reentering the password), and it started normally again as expected.

Don't know if this counts as a 'fix' so much, but that's what worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文