Why won't my .Net Windows service start automatically after a reboot?

血红的双手。 提交于 2019-12-11 06:47:02

问题


I get the error below in the event log when the computer boots, the service is set to automatically start, when I manually start the service it starts without a problem.

Any ideas?

Service cannot be started. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80010002): Call was canceled by the message filter. (Exception from HRESULT: 0x80010002 (RPC_E_CALL_CANCELED)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

Thanks


回答1:


Does your service depend on some other component/service that may not have started up yet at machine boot?




回答2:


You can fix this by adding a dependency to the Windows Management Instrumentation service (winmgmt.exe).

Please see my answer here: https://stackoverflow.com/a/13454379/1003958



来源:https://stackoverflow.com/questions/998883/why-wont-my-net-windows-service-start-automatically-after-a-reboot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!