![](/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.