需要将Windows服务与非管理员用户进程同步
我正在使用 (.NET2.0) 服务定期执行特权操作,并通过 IPC 通过非管理员用户 (.NET2.0) 进程将结果返回到共享内存。
我在从管理员帐户进行开发时一直使用全局命名的互斥体,但是当我在有限帐户上尝试该应用程序时,出现错误:
其他信息:对路径“Global\timersyncu33sc3c2sd42frandomlynamedmutexoijfvgf9v3f32”的访问被拒绝。
非特权用户是否可以通过其他方式与服务交互?或者我应该只共享轮询和更新时间的周期并希望这些值能够自动写入/读取?
I am using a (.NET2.0) service to periodically carry out privileged actions and return the result to shared memory, via IPC, with a non-admin user's (.NET2.0) process.
I have been using globally named mutexes while developing from my administrator account but when I come to try the application on a limited account I get the error:
Additional information: Access to the path 'Global\timersyncu33sc3c2sd42frandomlynamedmutexoijfvgf9v3f32' is denied.
Is there some other way a non-privileged user can interact with a Service? Or should I just share the period of polling and update time and hope those values get written/read atomically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会使用 WCF 与服务进行对话。这消除了特权/身份问题。
但是,由于您的代码位于 .NET 2.0 中,因此您可以使用 Remoting 或 NamedPipes 与服务通信。
I would talk to the service using WCF. This eliminates the privileges/identity problem.
However since your code is in .NET 2.0 you could use Remoting or NamedPipes to talk to the service.
我发现了以下方法,可以在有限用户登录并启动 GUI 时向他们授予访问权限。请注意,函数 getUsername(/*somehow*/); 有多个版本,我没有列出在 XP 上运行的实现,我确信还有其他方法,尽管我发现了 4 种方法中的 3 种不适合我。
I found the following method of granting access to my limited users as they log on and fire up their GUI. Note the function
getUsername(/*somehow*/);
had several incarnations and I'm not listing the implementation that worked on XP, I'm sure there are other ways though 3 of the 4 I found didn't work for me.