【问题标题】:Do windows services log why they wont start?Windows 服务是否会记录它们无法启动的原因?
【发布时间】:2015-09-04 14:27:59
【问题描述】:

我有一个无法在全新的 windows server 2012 安装上启动的 windows 服务。

当我尝试启动服务时,我收到此错误。

本地计算机上的 Foobar 服务启动然后停止。如果某些服务没有被其他服务或程序使用,它们会自动停止。

我来自 linux 背景,并且不经常使用 Windows。在我的故障排除尝试中,我已经能够收集以下日志。

The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.\u000d\u000a   at System.Diagnostics.PerformanceCounter.InitializeImpl()\u000d\u000a   at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)\u000d\u000a   at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, Boolean readOnly)\u000d\u000a   at foobar.sage.OnStart(String[]

我从谷歌首页尝试过的东西。

https://stackoverflow.com/a/2081976/1626687

PS C:\Users\sowen> lodctr C:\Windows\Microsoft.NET\Framework\v4.0.30319\CORPerfMonExt.dll
PS C:\Users\sowen> lodctr C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CORPerfMonExt.dll

https://stackoverflow.com/a/14513897/1626687

PS C:\Users\sowen> unlodctr .NETFramework
Removing counter names and explain text for .NETFramework
Updating text for language 009PS 
PS C:\Users\sowen> lodctr 'C:\Windows\Inf\.NETFramework\corperfmonsymbols.ini'

https://social.technet.microsoft.com/Forums/windowsserver/en-US/46a21b31-f5fc-4a44-bd4c-c9884a923943/performance-monitor-in-windows-server-2012

修改 HKLM/\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
禁用性能计数器 = 0

loadctl /r

这些尝试都没有解决问题。有没有一个地方可以让 Windows 显示额外的日志记录,为什么这个服务不会启动?

【问题讨论】:

  • 这个软件是你开发的吗?还是由第三方开发的?
  • 很久以前在我公司开发的。该应用程序正在所有现有服务器上运行,但不会在我正在创建的新服务器上运行。
  • 你还有源代码吗?如果你不这样做,这不是一个真正的编程问题,更适合Server Fault
  • 你是正确的石匠,搬到旧金山

标签: windows dll service


【解决方案1】:

除了查看事件查看器之外,您似乎无法为日志记录做更多事情。

我终于通过使用 InstallUtil 而不是 sc.exe 来运行它

sc.exe create foobar obj= "example.com\\someuser" password= "correct-horse-battery-staple" binPath= c:\foobar.exe start= auto depends= "MSMQ"

sc.exe delete foobar

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /user="example.com\someuser" /password="correct-horse-battery-staple" c:\foobar.exe

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多