WindowsService问题


正在开始安装的“安装”阶段。
查看日志文件的内容以获得 C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects
\Test_Service\Test_Service\bin\Debug\test_service.exe 程序集的进度。
该文件位于 C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Service\
Test_Service\bin\Debug\test_service.InstallLog。
正在安装程序集“C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Ser
vice\Test_Service\bin\Debug\test_service.exe”。
受影响的参数是:
logtoconsole =
assemblypath = C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_S
ervice\Test_Service\bin\Debug\test_service.exe
i =
logfile = C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Servic
e\Test_Service\bin\Debug\test_service.InstallLog
正在安装服务 Service1...
正在日志 Application 中创建 EventLog 源 Service1...

在“安装”阶段发生异常。
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可
访问的日志: Security。


正在开始安装的“回滚”阶段。
查看日志文件的内容以获得 C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects
\Test_Service\Test_Service\bin\Debug\test_service.exe 程序集的进度。
该文件位于 C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Service\
Test_Service\bin\Debug\test_service.InstallLog。
正在回滚程序集“C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Ser
vice\Test_Service\bin\Debug\test_service.exe”。
受影响的参数是:
logtoconsole =
assemblypath = C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_S
ervice\Test_Service\bin\Debug\test_service.exe
i =
logfile = C:\Users\Ramon.Fu\Documents\Visual Studio 2005\Projects\Test_Servic
e\Test_Service\bin\Debug\test_service.InstallLog
正在将事件日志还原到源 Service1 的前一状态。
在 System.Diagnostics.EventLogInstaller 安装程序的“回滚”阶段发生异常。
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可
访问的日志: Security。
在安装的“回滚”阶段发生异常。将忽略该异常并继续回滚。但是,在完成回滚后计算机可
能无法完全还原到它的初始状态。

“回滚”阶段已成功完成。

已完成事务处理安装。
安装失败,已执行回滚。

解决方案:

用管理员身份运行 cmd.exe 然后再次尝试 installutil,这个问题多半是因为 UAC 导致的。

您的系统看上去像是 Windows Vista 或者 Windows 7,所以需要管理员身份运行它。

原文地址:https://www.cnblogs.com/fjzhang/p/2729188.html