我正在使用 installutil.exe 安装 Windows 服务并遇到以下错误。
C:\Windows\Microsoft.NET\Framework\v4.0.30319>InstallUtil.exe D:\WindowsService1 .exe;
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.33440 Copyright (C) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or assembly 'file:///D:\Win dowsService1.exe;' or one of its dependencies. The system cannot find the file s pecified..
我的文件正好位于那个位置。
最佳答案
使用 sc
命令安装您的服务。
使用管理员权限打开 CMD
并运行以下命令进行安装。
SC create WindowsService1 displayname= "WindowsService1" binpath= "D:\WindowsService1.exe" start= auto
关于c# - Windows服务安装过程中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31224045/