在Windows 7上安装C#Windows服务

前端之家收集整理的这篇文章主要介绍了在Windows 7上安装C#Windows服务前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个批处理文件,我一直用来安装我的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.NET\Framework\v2.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:\Users\Justin\Desktop\service
test\IEPPAMS_WinService1.exe
assembly’s progress. The file is
located at
C:\Users\Justin\Desktop\service
test\IEPPAMS_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:\Users\Justin\Desktop\service
test\IEPPAMS_WinService1.exe
assembly’s progress. The file is
located at
C:\Users\Justin\Desktop\service
test\IEPPAMS_WinService1.InstallLog.

The Rollback phase completed
successfully.

The transacted install has completed.

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

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

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

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

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

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

原文链接:https://www.f2er.com/windows/364856.html

猜你在找的Windows相关文章