安装Windows服务凭证时, [英] Credentials when Installing Windows Service

查看:174
本文介绍了安装Windows服务凭证时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装使用VisualStudio.Net部署项目中的C#Windows服务项目。

I am attempting to install a C# windows service project using a VisualStudio.Net deployment project.

要运行部署项目我单击鼠标右键,然后从上下文菜单中选择安装,安装向导运行,并最终促使我一个设置服务登录对话框它要求用户名和放大器;密码。

To run the deployment project I right-click and select "install" from the context menu, the install wizard runs and eventually prompts me with a "Set Service Login" dialog which asks for username & password.

当我安装使用SC实用工具命令行服务,我没有提供凭据。

When I install a service using the sc utility from the command line, I don't have to provide credentials.

我一定要创建一个登录只是这项服务?我宁愿使用本地系统或网络服务(不知道有什么区别)其他服务做的。

Do I have to create a login just for this service? I'd prefer to use "Local System" or "Network Service" (not sure what the difference is) as other services do.

推荐答案

此代码添加到您的Windows服务项目projectInstaller.Designer.cs文件您的私人无效InitializeComponent()方法。

Add this code to your private void InitializeComponent() method in projectInstaller.Designer.cs file in your windows service project.

    this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;

如果你的定义过程的安装程序是:

if the definition of you process installer is:

    private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;



希望帮助您!

Hope that helps you !

这篇关于安装Windows服务凭证时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆