C#:设置ACL时遇到问题 [英] C#: Trouble setting ACL

查看:87
本文介绍了C#:设置ACL时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个以管理员身份执行的桌面应用程序。我正在尝试在目录上设置ACL,但获取异常:


"安全标识符不允许是此对象的所有者" 

解决方案

您是否以SYSTEM身份运行? 


取决于谁创建在installPath中,所有者将通过继承自动成为SYSTEM。你真的不需要这个电话:

 directorySecurity.SetOwner(owner); 

这取决于你想要做什么。


谢谢


Frank K [MSFT] 在Twitter上关注我们,
www.twitter.com/WindowsSDK
。 


I am writing a desktop app that will be executed as administrator. I am trying to set an ACL on a directory, but getting the exception:

"The security identifier is not allowed to be the owner of this object" 

解决方案

Are you running as SYSTEM? 

Depending on who is creating the installPath, the owner will automatically be SYSTEM through inheritance. You don't really need the call:

directorySecurity.SetOwner(owner);

It really depends on what you are trying to do.

thanks

Frank K [MSFT]Follow us on Twitter, www.twitter.com/WindowsSDK


这篇关于C#:设置ACL时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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