我试图使用以下代码在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);
错误发生在上面代码的最后一行。 任何帮助或线索摆脱这一点是非常感谢