在 Windows Server 上安装 C# 服务(拒绝访问)

2024-06-23

我创建了一个 C# 服务。现在我想在 Windows Server 2008 R2 上安装该服务。 我正在使用安装工具命令来安装服务。我以管理员身份打开命令提示符。

该服务应以特定用户身份运行,因此我将帐户设置为服务安装程序上的用户。

当我运行命令时出现错误:

Install阶段出现异常:System.ComponentModel.Win32Exception: Access Denied.

这是日志文件:

Installing assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe
Rolling back assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe
An exception occurred during the Rollback phase of the System.ServiceProcess.ServiceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an object.
An exception occurred during the Rollback phase of the installation. This exception will be     ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

以下是命令提示符上显示的内容:

Beginning the Install phase of the installation.
See the contents of the log file for the C:\Service\MyService.exe assembly's progress.
The file is located at C:\Service\MyService.InstallLog.
Installing assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole =
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe

An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: Access Denied
   at System.ServiceProcess.ServiceProcessInstaller.OpenSecurityPolicy()
   at System.ServiceProcess.ServiceProcessInstaller.Install(IDictionary stateSaver)
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
   at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedState)
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)

The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Service\MyService.exe assembly's progress.
The file is located at C:\Service\MyService.InstallLog.
Rolling back assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole =
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe
An exception occurred during the Rollback phase of the System.ServiceProcess.Ser
viceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

The Rollback phase completed successfully.

The transacted install has completed.
The installation failed, and the rollback has been performed.

有人知道我需要做什么才能安装该服务吗?


我终于可以安装该服务了。我以服务器管理员的角色登录到服务器。我的管理员将我的帐户添加到服务器的本地管理员组中。之后我就可以安装该服务了。看起来就像我用来登录系统的服务器管理员帐户没有完全的管理员权限。

感谢您的帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Windows Server 上安装 C# 服务(拒绝访问) 的相关文章

  • C 和 C++ 中的“**”是什么意思?

    当一个对象开头有两个星号时意味着什么 variable 在声明中 这意味着它是一个指向指针的指针 int x declare x as a pointer to a pointer to an int 使用它时 它会引用它两次 int x
  • Asp.Net Mvc 5 图像不显示

    我有相同的图像Content and Views文件夹 我正在尝试显示图像 如下所示 img src Content Images download png alt Content folder br br img src Views Ho
  • WPF DataGrid 在行删除后失去焦点

    我正在使用 WPF DataGrid 通过键盘 删除 键进行行删除 但是 删除该行后 DataGrid 失去焦点 并且 DataGrid SelectedIndex 1 与WinForm datagrid相比 删除一行后 焦点自动转移到下一
  • clangd 中有“includePath”选项吗?

    我曾经使用 VSCodeC C https marketplace visualstudio com items itemName ms vscode cpptools扩大 这个扩展中有一个功能 在 json 文件中 称为 includeP
  • 在运行时更改语言的正确方法

    在运行时更改表单语言的正确方法是什么 使用递归手动设置所有控件 例如this https stackoverflow com questions 7556367 how do i change the culture of a winfor
  • Qt:将事件发布到 QThread 的正确方法?

    在我的 Qt 应用程序中 我有一个主线程和一个工作线程 工作线程子类QThread并通过处理事件customEvent 这是主线程发送要由工作线程处理的事件的正确方法吗 QThread myWorkerThread QApplication
  • 在简单/未命名的 C# LINQ 组连接中排序内部密钥源

    我知道这个问题由于用词不同而读起来很奇怪 但这是使用的术语这个 MSDN 页面 http msdn microsoft com en us library bb311040 aspx从我正在学习 LINQ 组的地方开始 我将解释它们 我正在
  • IE7 中的多个选项卡和一个工具栏实例

    我用 C 开发了一个用于 Internet Explorer 的工具栏 用于从外部应用程序发送和接收 URL 它在 IE6 中运行得很好 但我想在新版本 IE7 中利用选项卡式浏览 但我在那里遇到了障碍 似乎在 IE7 中 每个选项卡都有一
  • ASP.NET身份更改密码

    我需要能够由管理员更改用户密码 因此 管理员不应输入用户的当前密码 他应该能够设置新密码 我查看了 ChangePasswordAsync 方法 但该方法需要输入旧密码 因此 此方法不适合此任务 因此我通过以下方式做到了 HttpPost
  • 为什么我们不能将新字符串分配给 char 数组,而是分配给指针?

    我试图将字符串重新分配给预初始化的数组 a 但我得到的只是一个错误 main char a Sunstroke char b Coldwave a Coldwave b Sunstroke printf n s s a b 错误 从类型 c
  • 从 ASP.NET 插入到 MS Access

    我们正在尝试建立一个专门用于内联网的服务台票务系统 决定使用 Visual Studio 2008 Express 的 ASP NET C 如果需要的话 我们有一个完整版本 没什么花哨的 几页抓取 NTLM 信息 系统信息并将其与问题一起存
  • 如果相关服务被终止,如何更新小部件?

    我有一个录音应用程序 目前正在为其开发一个小部件 录音是由在前台状态的服务中运行的音频引擎执行的 每当音频引擎状态更改为暂停 播放 录制时 就会发送广播 并由更新小部件的接收器进行处理 这样 单击小部件中的录制按钮就会开始录制 这会导致发送
  • Boost的Dijkstra算法教程

    我很难弄清楚如何使用 Boost 的 Dijkstra 算法 我已经阅读了他们的示例和文档 但我仍然无法理解如何使用它 Boost的文档 http www boost org doc libs 1 50 0 libs graph doc d
  • 在所有 DataTable 列中查找字符串

    我正在尝试找到一种快速方法来在所有数据表列中查找字符串 跟随不起作用 因为我想在所有列值中搜索 string str whatever foreach DataRow row in dataTable Rows foreach DataCo
  • 如何搜索来自另一个页面模型的串联名称列表?

    我的项目中有多个模型 但在下面的屏幕中 大多数字段 属性都位于 SecurityLog 模型中 下面是我显示的官员串联列表 除了军官姓名之外 我的搜索和列标题排序功能正常 我很难合并官员姓名 因为该列表来自另一个页面模型 这是我的数据库架构
  • 将 double 转换为 float 后值不正确

    我有一些由 gcc gcc GCC 4 4 4 20100726 Red Hat 4 4 4 13 编译的执行高精度算术的 C 代码 计算的最终结果是一个 double 值 其值为 622 07999995861189 我是将双精度型转换为
  • 如何在 WinRT 中从 C++ 获取堆栈跟踪?

    我需要从 C 应用程序获取堆栈跟踪 并将其序列化为字符串 以便稍后解析 我在 Windows 上听说过的唯一 API 是 StackWalk64 它似乎不受支持 如何在 Windows 应用商店应用程序中从 C 获取堆栈跟踪 我能够调试复杂
  • 生成一定范围内的 N 个随机数,其总和为常数

    我想生成从 a b 之间的特定分布 例如均匀随机 抽取的 N 个随机数 其总和为常数 C 我尝试了一些我自己能想到的解决方案 以及在类似线程上提出的一些解决方案 但是他们中的大多数要么适用于有限形式的问题 要么我无法证明结果仍然遵循所需的分
  • 同一个盒子上的进程间通信 - 2 个应用程序或进程之间的通信

    在同一机器上的应用程序之间实现进程间通信的最佳方法是什么 两者都是用 C 编写的 管理器应用程序将向其他应用程序发送命令 例如 停止 启动 它还将监视应用程序并可能要求提供数据 所有应用程序都将在同一台运行 Windows 7 操作系统的计
  • Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential 不采用 2 个参数?

    我在代码中使用 ADAL 我想要使 用的一件事是使用不同的凭据 因此我可以在控制台程序中针对 Azure AD 授权不同的用户 Microsoft IdentityModel Clients ActiveDirectory UserCred

随机推荐