如何使用用户登录帐户启动Windows服务 [英] how to Start Windows Service with User Login Account

查看:236
本文介绍了如何使用用户登录帐户启动Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



这里我开发了Windows Service.Its在管理员帐户中工作正常但是当用户登录时,Windows服务获得例外。例外情况是无法打开服务计算机。我已经检查了应用程序清单file.its工作,但我不想使用appmanifest文件。通过代码我想访问管理previlages.So如果有任何信息请与我分享。



Dear Friends,

Here i Developed Windows Service.Its Working Fine in Adminstrator Account But when comes to User Logins the Windows Service Getting an Exception.The Exception is cannot open service computer.I have Checked with app manifest file.its working but i dont want to use appmanifest file.Trough Code i want to acess the administrative previlages.So if any Information Regarding this please share with me.

foreach (ServiceController scrTemp in scr)
                {
                    if (scrTemp.ServiceName == "DEMIS_MSMS_SERVICE")
                    {
                      
                            flg = 1;
                            scrTemp.Refresh();
                            string str1 = scrTemp.Status.ToString();
                            if (str1 == "Running")
}
}



这是示例代码但是我得到异常无法在您的计算机上打开DEMIS_MSMS_SERVICE

问候,



Sravanthi


this is sample code but iam getting an exception cannot open DEMIS_MSMS_SERVICE on your computer
Regards,

Sravanthi

推荐答案

服务也有ACL-s。如果您不想授予用户访问所有服务的权限,则可以设置单独的服务控制权限。您可以使用 SetACL [ ^ ]例如(从命令行甚至从应用程序通过我是COM接口)在服务上设置ACL。
Services also have ACL-s. If you don''t want to grant access to all services to a user, you can set up individual service control rights. You can use SetACL[^] for example (from command line or even from an application via i''ts COM interface) to set ACLs on Services.


这篇关于如何使用用户登录帐户启动Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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