2

我试图使用以下代码在 IIS 中的 Web 应用程序下查找文件夹,但遇到以下错误:

AccessViolationException: Attempted to read or write protected memory.

我尝试的代码如下所示:

DirectoryEntry entry2 = new DirectoryEntry(string.Format("IIS://{0}/W3SVC/{1}/Root/{2}", serverName, siteID, parentVirDirName));
entry2.RefreshCache();
DirectoryEntry entry3 = entry2.Children.Find(folderToSearch);

错误发生在上面代码的最后一行。非常感谢任何帮助或摆脱这种情况的线索

4

0 回答 0