Windows服务和控制台应用程序之间的权限差异 [英] Permission differences between windows service and console application

查看:170
本文介绍了Windows服务和控制台应用程序之间的权限差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个涉及智能卡(数字签名)的应用程序.假设我们在这两个上下文中具有相同的代码:

I'm developing an application with a smart card involved (digital signature). Let's assume that we have the same code in this two contexts:

  • 控制台应用程序,由管理员用户执行
  • Windows服务,由管理员用户执行

我认为,如果这两个代码是由同一用户执行的,则它们将具有相同的特权.看来这是不正确的.当我尝试使用Windows服务(由管理员用户执行)时,我会收到

I suposed that if this two codes were executed by the same user they would have the same privileges. It seems that this is not true. When I try with the Windows Service (Executed with Administrator user) i receive

TargetInvocationException
CryptographicException

Can't initialize DLL provider at System.Security.Cryptography.Utils.CreateProvHandle(.

就我在互联网上阅读的内容来说,也许是权限问题之王.控制台应用程序运行正常.

As far as I read on internet maybe is some king of permissions issue. Console Application works OK.

  • 如果Windows Service和控制台应用程序由同一用户执行,它们之间有什么区别?

  • What is the difference between the Windows Service and Console Application if they are executed by the same user?

是否可以使用Windows Service获得相同的结果?

Is possible to achieve the same results with Windows Service?

为解决它的人免费提供虚拟啤酒;)

Free virtual beers for the person who solves it ;)

谢谢!

推荐答案

您是否尝试过将服务作为本地服务,网络服务和本地系统运行?改变这些没有区别吗?我知道我必须将我的文件从本地服务"更改为本地系统",以使其能够访问我的文件.不知道您是否正在使用任何文件,但至少要检查一下.

Have you tried running your service as Local Service, Network Service, and Local System? No difference with changing these? I know I had to change mine from Local Service to Local System to give it access to my files. Not sure if you're even using any files, but at least it's something to check.

这篇关于Windows服务和控制台应用程序之间的权限差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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