C# 我的代码有什么问题。多窗口服务
我正在使用windows服务。我有一个serviceProcessInstaller1,帐户名为本地系统。我又添加了一个安装程序作为serviceInstaller2,但当我尝试以管理员身份使用Developer CMD手动安装它时,它表示安装失败,并且已执行回滚。我还将serviceInstaller1和ServiceInstaller2的服务名称更改为myservice1,myservice2。我的代码有0个错误和0个警告C# 我的代码有什么问题。多窗口服务,c#,installation,console-application,multiple-instances,service-application,C#,Installation,Console Application,Multiple Instances,Service Application,我正在使用windows服务。我有一个serviceProcessInstaller1,帐户名为本地系统。我又添加了一个安装程序作为serviceInstaller2,但当我尝试以管理员身份使用Developer CMD手动安装它时,它表示安装失败,并且已执行回滚。我还将serviceInstaller1和ServiceInstaller2的服务名称更改为myservice1,myservice2。我的代码有0个错误和0个警告 //program.cs names
//program.cs
namespace WindowsService1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
#if DEBUG
Service1 myservice=new Service1();
myservice.OnDebug();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#else
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1(),
new Service2()
};
ServiceBase.Run(ServicesToRun);
#endif
}
}
}
//日志文件
正在安装程序集“C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe”。
受影响的参数包括:
logtoconsole=
logfile=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
assemblypath=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe
正在安装服务测试1。。。
服务Servicetest1已成功安装。
正在日志应用程序中创建EventLog源Servicetest1。。。
System.ServiceProcess.ServiceInstaller的OnAfterInstall事件处理程序中发生异常。
System.InvalidOperationException:无法在计算机“”上启动服务Servicetest1。
引发内部异常System.ComponentModel.Win32Exception,并显示以下错误消息:配置为运行此服务的可执行程序未实现该服务。
正在回滚程序集“C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe”。
受影响的参数包括:
logtoconsole=
logfile=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
assemblypath=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe
正在将源Servicetest1的事件日志还原到以前的状态。
正在从系统中删除服务Servicetest1。。。
已成功从系统中删除服务Servicetest1。
正在安装程序集“C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe”。
受影响的参数包括:
logtoconsole=
logfile=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
assemblypath=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe
正在安装服务测试1。。。
服务Servicetest1已成功安装。
正在日志应用程序中创建EventLog源Servicetest1。。。
System.ServiceProcess.ServiceInstaller的OnAfterInstall事件处理程序中发生异常。
System.InvalidOperationException:无法在计算机“”上启动服务Servicetest1。
引发内部异常System.ComponentModel.Win32Exception,并显示以下错误消息:配置为运行此服务的可执行程序未实现该服务。
正在回滚程序集“C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe”。
受影响的参数包括:
logtoconsole=
logfile=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
assemblypath=C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe
正在将源Servicetest1的事件日志还原到以前的状态。
正在从系统中删除服务Servicetest1。。。
已成功从系统中删除服务Servicetest1。
..........................
//installutil日志文件
正在运行事务处理安装
开始安装的安装阶段。
有关C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe程序集的进度,请参阅日志文件的内容。
该文件位于C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
安装阶段发生异常。
System.InvalidOperationException:System.ServiceProcess.ServiceInstaller的OnAfterInstall事件处理程序中发生异常。
引发内部异常System.InvalidOperationException,并显示以下错误消息:无法在计算机“”上启动服务Servicetest1。。
引发内部异常System.ComponentModel.Win32Exception,并显示以下错误消息:配置为运行此服务的可执行程序未实现该服务
安装的回滚阶段正在开始。
有关C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe程序集的进度,请参阅日志文件的内容。
该文件位于C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
回滚阶段已成功完成
已完成事务处理的安装
正在运行事务处理安装
开始的安装阶段
安装
有关C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe程序集的进度,请参阅日志文件的内容。
该文件位于C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
安装阶段发生异常。
System.InvalidOperationException:System.ServiceProcess.ServiceInstaller的OnAfterInstall事件处理程序中发生异常。
引发内部异常System.InvalidOperationException,并显示以下错误消息:无法在计算机“”上启动服务Servicetest1。。
引发内部异常System.ComponentModel.Win32Exception,并显示以下错误消息:配置为运行此服务的可执行程序未实现该服务
安装的回滚阶段正在开始。
有关C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.exe程序集的进度,请参阅日志文件的内容。
该文件位于C:\Users\Curtis Hagen\Desktop\WindowsService1\WindowsService1\bin\Release\WindowsService1.InstallLog
回滚阶段已成功完成
事务性安装已完成。它将在可执行位置创建日志文件。你能看一下错误细节吗?我已经编辑了我的问题并添加了你要求的日志文件。我第一次创建服务项目时,它运行正常,当我对其进行更改时,安装失败。它现在可以正常工作,但我必须在private void serviceInstaller1\u AfterInstall\u 1 Object sender中注释我的代码,InstallEventArgs e现在我必须在安装后手动启动我的服务,我可以更改服务属性的设置,使其自动或其他任何形式。@Anri我有这个项目。当用户在登录屏幕输入错误的密码时,网络摄像头应拍摄快照。当用户打开regedit或disable firewall时,程序应该截图。所有这些图像都将保存在system32文件夹中folder无法在其中创建内容,需要花费数周时间来创建,然后通过电子邮件发送给我。我已经做了网络摄像头部分,电子邮件部分,甚至登录,regedit和防火墙日志部分。我的问题是windows如何处理多个服务。如果我为我的3个事件创建3个服务,它们会同时独立运行吗?是的,服务将在一个可执行文件中并行运行