仮想ディレクトリを作成し、IIS7 と C# を使用してアクセス許可を設定しようとしています。これが私のコードのサンプルです:
using (ServerManager serverManager = new ServerManager(webSite))
{
ConfigurationSection anonymousAuthenticationSection =
config.GetSection(
@"system.webServer/security/authentication/anonymousAuthentication",
webSite);
anonymousAuthenticationSection["enabled"] = true;
serverManager.CommitChanges();
return "true";
}
これは例外をスローし、メッセージは次のとおりです。
Cannot read configuration file due to insufficient permissions.
誰か助けてくれませんか?
編集
管理者権限で実行すると、「構成ファイルの読み取りを有効にします」という新しいエラーが表示されます。どの構成を読み取る必要があり、どのようにアクセスできるか教えてもらえますか?