![](/img/trans.png)
[英]Access to the path 'c:\windows\system32\inetsrv\config\' is denied
[英]How to get access control of C:\Windows\System32\inetsrv\config folder using c# asp.net
我正在尝试授予C:\\ Windows \\ System32 \\ inetsrv \\ config文件夹的权限。 但是,当我使用以下代码时,它将引发异常“尝试执行未经授权的操作”。
string desktopFolderPath = @"C:\Windows\System32\inetsrv\config";
FileSystemAccessRule iis_iusrs = new FileSystemAccessRule("IIS_IUSRS",
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Allow);
FileSystemAccessRule networkService = new FileSystemAccessRule("NETWORK SERVICE",
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Allow);
System.IO.DirectoryInfo desktopFolderDirectory = new System.IO.DirectoryInfo(desktopFolderPath);
DirectorySecurity directorySecurity = null;
directorySecurity = desktopFolderDirectory.GetAccessControl(); -- **Exception**
directorySecurity.AddAccessRule(iis_iusrs);
directorySecurity.AddAccessRule(networkService);
desktopFolderDirectory.SetAccessControl(directorySecurity);
如果有人可以,请帮忙。 提前致谢。
转到文件夹路径“ Properties
,并确保未选中“只读”复选框。
这可能会有所帮助: 链接
如果没有,请尝试共享文件夹。
顺便说一句,它是系统文件夹,可能无法访问,因此请尝试在
C:\\inetpub
托管页面
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.