c# - Windows服务安装过程中的问题

标签 c#

我正在使用 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/

相关文章:

c# - ASP.NET Core 2.1 Web API 添加JWT 认证的同时,是否需要像AspNetUsers 这样创建表?

c# - 允许用户只输入文字?

c# - 代码在 Release模式和 Debug模式下的行为不同

c# - wix - 安装前删除旧的程序文件夹

c# - 在 WCF 客户端/服务器应用程序中计算 UTC/本地日期时间转换的最佳方法

c# - 是否有任何算法可以在给定定义形状的坐标的情况下计算形状的面积?

c# - 影片下载

c# - 填充编辑文本后启用按钮

c# - Max,SelectMany,可能没有响应

c# - 有什么办法可以给 c# 枚举一个 "range"的允许值吗?