3
ISAPIフィルタをc#およびMicrosoft.Web.Administrationアセンブリを使用して追加/設定しようとしています。これまでは、単一のWebサイトにISAPIフィルタを追加することはできませんでした。Microsoft.Web.Administrationを使用して既存のサイトにISAPIフィルタを追加する
IIS全体のグローバル設定で追加するには、this Article (http://www.iis.net/ConfigReference/system.webServer/isapiFilters)が見つかりました。私は特定のサイトに必要なだけです。私はIIS 7.5を使用しています。
ServerManager serverManager = new ServerManager();
Configuration config = serverManager.GetApplicationHostConfiguration();
// Change this line:
ConfigurationSection isapiFiltersSection =
config.GetSection("system.webServer/isapiFilters");
// To this by adding an extra param specifying the site name:
ConfigurationSection isapiFiltersSection =
config.GetSection("system.webServer/isapiFilters", "my site name");
ConfigurationElementCollection isapiFiltersCollection =
isapiFiltersSection.GetCollection();
ConfigurationElement filterElement =
isapiFiltersCollection.CreateElement("filter");
filterElement["name"] = @"SalesQueryIsapi";
filterElement["path"] = @"c:\Inetpub\www.contoso.com\filters\SalesQueryIsapi.dll";
filterElement["enabled"] = true;
filterElement["enableCache"] = true;
isapiFiltersCollection.Add(filterElement);
serverManager.CommitChanges();
あなたは、あなたが照会することができ、サイトの名前を知っているが、サイトのID(またはIIS番号)を知らない場合:あなたはちょうど(インラインコメントを参照してください)与えられた例を微調整する必要が
[ここ](http://forums.iis.net/t/1149623.aspx)は、IIS.netフォーラムの良いスレッドであり、あなたが行っていることを示すソースがあります後に。 –