次のコードを使用して、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);
上記のコードの最後の行でエラーが発生します。これから抜け出すための助けや手がかりは大歓迎です