VC# Service 无法启动

VC# Service (2008/08/16)

 

用 Vc#2005 安装帮助文档的步骤编写 Windows Service时,安装成功,但无法启动,Event Log 记录如下:

事件类型: 错误
事件来源: WindowsService1
事件种类: 无
事件 ID: 0
日期:  2008-8-18
事件:  8:31:32
用户:  N/A
计算机: BFF21965615E4FA
描述:
无法启动服务。System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可访问的日志: Security。
   在 System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
   在 System.Diagnostics.EventLog.SourceExists(String source, String machineName)
   在 System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)
   在 System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   在 System.Diagnostics.EventLog.WriteEntry(String message)
   在 WindowsService1.WindowsService1.OnStart(String[] args)
   在 System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
失败的程序集的区域是:
MyComputer

 

解决方法(通过小苏帮助):

serviceProcessInstaller1 中有一个account属性,如果需要访问权限高的, 最好设置成LocalSystem,
因为程序现在是用LocalService,可能不用访问系统日志

直接在windows服务管理 双击那个程序,在“登录”中改成“本地系统帐户”,它就能启动了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值