ASP <asp>
- 概要
- 互換性
- セットアップ
- 方法
- 構成
- サンプル コード
※本ページに挿入されている画像をクリックすると、画像全体が別ウィンドウで表示されます。
<asp>
要素は、ASP アプリケーションの構成設定を指定します。これらの構成設定には、デバッグとエラー通知の設定を制御する属性などの、開発者中心の構成設定が含まれます。また、<asp>
要素には、アプリケーションが使用する文字セット、アプリケーションのスクリプト言語、およびアプリケーションに対してエラーのログ記録を有効にするかどうかを制御する属性も含まれます。
<asp>
要素には、COM+、ASP キャッシュ、バッファー処理制限、およびサイトやアプリケーションのセッション状態を構成する要素が含まれる場合もあります。
IIS 7.0 | IIS 6.0 | |
---|---|---|
注意 | <asp> は IIS 7.0 で新たに導入された要素です。 |
|
Web サーバー上の ASP アプリケーションをサポートおよび構成するには、ASP モジュールをインストールする必要があります。ASP モジュールをインストールする手順は次のとおりです。
タスク バーで [スタート] をクリックし、[管理ツール] をポイントして [サーバー マネージャー] をクリックします。
[サーバー マネージャー] ウィンドウのツリー表示で、[役割] を展開して [Web サーバー (IIS)] をクリックします。
[Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールして [役割サービスの追加] をクリックします。
役割サービスの追加ウィザードの [役割サービスの選択] ページで、[ASP] を選択します。
[ASP に必要な役割サービスを追加しますか] ダイアログ ボックスが表示されたら、[必要な役割サービスを追加] をクリックします (このページは、"ISAPI 拡張" 役割サービスをサーバーにまだインストールしていない場合にのみ表示されます)。
[役割サービスの選択] ページで [次へ] をクリックします。
[インストール オプションの確認] ページで [インストール] をクリックします。
[結果] ページで [閉じる] をクリックします。
タスク バーで [スタート] をクリックし、[コントロール パネル] をクリックします。
[コントロール パネル] で、[プログラムと機能]、[Windows の機能の有効化または無効化] の順にクリックします。
[Internet Information Services]、[World Wide Web サービス]、[アプリケーション開発機能] の順に展開します。
[ASP] を選択して、[OK] をクリックします。
タスク バーで [スタート] をクリックし、[管理ツール] をポイントして [インターネット インフォメーション サービス (IIS) マネージャー] をクリックします。
[接続] ウィンドウで当該サーバー名を展開して [サイト] を展開し、構成する Web サイトまたは Web アプリケーションを選択します。
サイトまたはアプリケーションの [ホーム] ウィンドウで [ASP] をダブルクリックします。
[ASP] ウィンドウで必要な設定を構成してから、[操作] ウィンドウの [適用] をクリックします。
サーバー レベルの <asp>
要素は ApplicationHost.config ファイルで構成できます。ただし既定では、サイト レベルまたはアプリケーション レベルの <asp>
要素を構成することはできません。
属性 | 説明 |
---|---|
appAllowClientDebug |
オプションの Boolean 属性。 |
appAllowDebugging |
オプションの Boolean 属性。 |
bufferingOn |
オプションの Boolean 属性。 |
calcLineNumber |
オプションの Boolean 属性。 |
codePage |
オプションの unit 属性。 |
enableApplicationRestart |
オプションの Boolean 属性。 |
enableAspHtmlFallback |
オプションの Boolean 属性。 |
enableChunkedEncoding |
オプションの Boolean 属性。 |
enableParentPaths |
オプションの Boolean 属性。 |
errorsToNTLog |
オプションの Boolean 属性。 |
exceptionCatchEnable |
オプションの Boolean 属性。 |
lcid |
オプションの unit 属性。 |
logErrorRequests |
オプションの Boolean 属性。 ASP エラーを既定でクライアント ブラウザーおよび IIS ログに書き込むかどうかを指定します。 既定値は |
runOnEndAnonymously |
オプションの Boolean 属性。 |
scriptErrorMessage |
オプションの string 属性。 |
scriptErrorSentToBrowser |
オプションの Boolean 属性。 |
scriptLanguage |
オプションの string 属性。 |
要素 | 説明 |
---|---|
cache |
オプションの要素。 ASP キャッシュの設定を指定します。 |
comPlus |
オプションの要素。 COM+ の設定を指定します。 |
limits |
オプションの要素。 さまざまな ASP プロパティの制限値を指定します。 |
session |
オプションの要素。 ASP セッション状態の設定を指定します。 |
次の構成例では、Contoso という名前のサイト上の ASP アプリケーションに対してバッファー処理とセッション状態を有効にすると共に、同じサイトに対して親パスを無効にします。
<location path="Contoso">
<system.webServer>
<asp enableParentPaths="false" bufferingOn="true">
<session allowSessionState="true" />
</asp>
</system.webServer>
</location>
次のコード例では、Contoso という名前のサイト上の ASP アプリケーションに対してバッファー処理とセッション状態を有効にすると共に、同じサイトに対して親パスを無効にします。
appcmd.exe set config "Contoso" -section:system.webServer/asp /enableParentPaths:"False" /commit:apphost
appcmd.exe set config "Contoso" -section:system.webServer/asp /bufferingOn:"True" /commit:apphost
appcmd.exe set config "Contoso" -section:system.webServer/asp /session.allowSessionState:"True" /commit:apphost
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection aspSection = config.GetSection("system.webServer/asp", "Contoso");
aspSection["enableParentPaths"] = false;
aspSection["bufferingOn"] = true;
ConfigurationElement sessionElement = aspSection.GetChildElement("session");
sessionElement["allowSessionState"] = true;
serverManager.CommitChanges();
}
}
}
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim aspSection As ConfigurationSection = config.GetSection("system.webServer/asp", "Contoso")
aspSection("enableParentPaths") = False
aspSection("bufferingOn") = True
Dim sessionElement As ConfigurationElement = aspSection.GetChildElement("session")
sessionElement("allowSessionState") = True
serverManager.CommitChanges()
End Sub
End Module
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var aspSection = adminManager.GetAdminSection("system.webServer/asp", "MACHINE/WEBROOT/APPHOST/Contoso");
aspSection.Properties.Item("enableParentPaths").Value = false;
aspSection.Properties.Item("bufferingOn").Value = true;
var sessionElement = aspSection.ChildElements.Item("session");
sessionElement.Properties.Item("allowSessionState").Value = true;
adminManager.CommitChanges();
Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set aspSection = adminManager.GetAdminSection("system.webServer/asp", "MACHINE/WEBROOT/APPHOST/Contoso")
aspSection.Properties.Item("enableParentPaths").Value = False
aspSection.Properties.Item("bufferingOn").Value = True
Set sessionElement = aspSection.ChildElements.Item("session")
sessionElement.Properties.Item("allowSessionState").Value = True
adminManager.CommitChanges()