加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在Windows 7上安装C#Windows服务

发布时间:2020-12-14 04:12:11 所属栏目:Windows 来源:网络整理
导读:我有一个批处理文件,我一直用来安装我的C# Windows服务一段时间,直到Windows 7才出现问题.我试图以管理员权限运行批处理文件.我试图使用admin privs运行命令提示符,导航到Windows服务EXE并在那里运行InstallUtil.仍然无法正常工作. 在阅读了一些其他建议之后
我有一个批处理文件,我一直用来安装我的C# Windows服务一段时间,直到Windows 7才出现问题.我试图以管理员权限运行批处理文件.我试图使用admin privs运行命令提示符,导航到Windows服务EXE并在那里运行InstallUtil.仍然无法正常工作.

在阅读了一些其他建议之后,我尝试将我的文件从/ bin文件夹中移出并从另一个位置运行它们,但这也无效.

批处理文件如下所示

@ECHO OFF

REM The following directory is for .NET 2.0
set DOTNETFX2=%SystemRoot%Microsoft.NETFrameworkv2.0.50727
set PATH=%PATH%;%DOTNETFX2%

echo Installing IEPPAMS Win Service...
echo ---------------------------------------------------
InstallUtil /i IEPPAMS_WinService1.exe
echo ---------------------------------------------------
echo Done.

我有一个安装日志文件,我将信息转储到.如果我只是双击我得到的.bat文件

Running a transacted installation.

Beginning the Install phase of the
installation. See the contents of the
log file for the
C:UsersJustinDesktopservice
testIEPPAMS_WinService1.exe
assembly’s progress. The file is
located at
C:UsersJustinDesktopservice
testIEPPAMS_WinService1.InstallLog.

An exception occurred during the
Install phase.
System.InvalidOperationException:
Cannot open Service Control Manager on
computer ‘.’. This operation might
require other privileges. The inner
exception
System.ComponentModel.Win32Exception
was thrown with the following error
message: Access is denied.

The Rollback phase of the installation
is beginning. See the contents of the
log file for the
C:UsersJustinDesktopservice
testIEPPAMS_WinService1.exe
assembly’s progress. The file is
located at
C:UsersJustinDesktopservice
testIEPPAMS_WinService1.InstallLog.

The Rollback phase completed
successfully.

The transacted install has completed.

当我使用管理员权限运行.bat文件时,没有任何内容写入日志文件,并且仍未安装该服务.

有什么想法吗?有没有新的方法在Windows 7中安装服务?

右键单击批处理文件并以管理员身份运行它.

您最有可能与Windows Vista和Windows 7中的新安全模型(用户帐户控制)发生争执.即使您作为具有管理员权限的帐户运行,您仍需要提升以执行某些(大多数)管理活动. (是的,可以禁用此功能,但不能)

> UAC (MSDN)
> UAC (Wikipedia)
> InstallUtil (MSDN)

编辑…正确的命令行是InstallUtil YourApp.exe. / i看起来不是InstallUtil的虚拟交换机.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读