[英]Installutil command cannot find windows service executable
I have created a windows service and would like to test it however when I attempt to try and install the service using the developer command prompt I get this error : 我已经创建了Windows服务,并想对其进行测试,但是当我尝试使用开发人员命令提示符尝试安装该服务时,出现此错误 :
Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\BackUpService.exe' or one of its dependencies.
初始化安装时发生异常:System.IO.FileNotFoundException:无法加载文件或程序集“ file:/// C:\\ Program Files(x86)\\ Microsoft Visual Studio 14.0 \\ BackUpService.exe”或其依赖项之一。 The system cannot find the file specified..
该系统找不到指定的文件..
the command i used was: installutil BackUpService.exe 我使用的命令是:installutil BackUpService.exe
I am not quite sure why I am getting this? 我不太确定为什么要得到这个?
It's look like you just forgot install(-i) word. 看起来您只是忘记了install(-i)字。
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe -i C:\BackupProject\bin\Debug\BackupService.exe
Use -u for uninstall. 使用-u进行卸载。
There is complete process of install & uninstall Windows Service on this link: https://stackoverflow.com/a/51788260/9888476 此链接上有完整的Windows Service安装和卸载过程: https : //stackoverflow.com/a/51788260/9888476
One way of figuring out what's missing here is by using Process Monitor . 解决这里遗漏的一种方法是使用Process Monitor 。 You would want to use the icons on the top right to limit the captured events to "Show File System Activity" only otherwise you'll get heaps of irrelevant information.
您可能只想使用右上角的图标将捕获的事件限制为“显示文件系统活动”,否则您将获得大量无关的信息。
According to my understanding you are using InstallUtil.exe to install the windows service. 据我了解,您正在使用InstallUtil.exe安装Windows服务。 In that case you have to specify full path of the windows service exe file in the command.
在这种情况下,您必须在命令中指定Windows Service exe文件的完整路径。
Like this 像这样
>InstallUtil.exe "C:\\dev\\DBBackupService\\BackUpService.exe" > InstallUtil.exe“ C:\\ dev \\ DBBackupService \\ BackUpService.exe”
Hopefully this will work. 希望这会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.