Share via


SiteLimits クラス

定義

Web サイトの接続関連の制限を公開します。

public ref class SiteLimits sealed : Microsoft::Web::Administration::ConfigurationElement
public sealed class SiteLimits : Microsoft.Web.Administration.ConfigurationElement
type SiteLimits = class
    inherit ConfigurationElement
Public NotInheritable Class SiteLimits
Inherits ConfigurationElement
継承

次の例では、 クラスのプロパティを SiteLimits 示します。 この例では、サービス モジュール内のオブジェクトをSite取得し、プロパティ値をSiteLimits変更し、オブジェクト (オブジェクトを含む) をSiteLimitsプロパティ バッグに配置Siteし、ページ モジュールにプロパティ値を表示します。

サービス モジュール:

// Gets the site collection from the server.
[ModuleServiceMethod(PassThrough = true)]
public ArrayList GetSiteCollection()
{
    // Use an ArrayList to transfer objects to the client.
    ArrayList arrayOfSiteBags = new ArrayList();

    ServerManager serverManager = new ServerManager();
    SiteCollection siteCollection = serverManager.Sites;
    foreach (Site site in siteCollection)
    {
        Boolean dirty = false;
        // Check the connection timeout. If > 300 seconds reset to 2 minutes.
        if (site.Limits.ConnectionTimeout > TimeSpan.FromSeconds(300))
        {
            site.Limits.ConnectionTimeout = TimeSpan.FromMinutes(2);
            dirty = true;
        } 
        // Check the maximum bandwidth. If <100000 reset to 4294967295.
        if (site.Limits.MaxBandwidth < 100000)
        {
            site.Limits.MaxBandwidth = 4294967295;
            dirty = true;
        }
        // Check the maximum connections. If <100 reset to 150.
        if (site.Limits.MaxConnections < 100)
        {
            site.Limits.MaxConnections = 150;
            dirty = true;
        }
        if (dirty)
        {
            serverManager.CommitChanges();
        }
        PropertyBag siteBag = new PropertyBag();
        siteBag[ServerManagerDemoGlobals.SitesArray] = site;
        arrayOfSiteBags.Add(siteBag);
    }
    return arrayOfSiteBags;
}

ページ モジュール:

_serviceProxy = (ServerManagerDemoModuleServiceProxy)
    Connection.CreateProxy(Module, typeof(ServerManagerDemoModuleServiceProxy));
    
// Get the site collection.
ArrayList siteCollectionArray = _serviceProxy.GetSiteCollection();
string sitedisplay = null;
sitedisplay = "There are " + siteCollectionArray.Count.ToString() + " sites.\n";
foreach (PropertyBag bag in siteCollectionArray)
{
    Site site = (Site)bag[ServerManagerDemoGlobals.SitesArray];
    sitedisplay += "   " + "ID: " + site.Id + " - " + site.Name + "\n";
    
    // Get the application collection for the site.
    ApplicationCollection applicationCollection = site.Applications;
    sitedisplay += "      has " + applicationCollection.Count + " applications:\n";
    foreach (Microsoft.Web.Administration.Application application in applicationCollection)
    {
        sitedisplay += "        path: " + application.Path + 
            ": in apppool - " + application.ApplicationPoolName + "\n";
    }

    // Get the Limits for the site.
    SiteLimits siteLimits = site.Limits;
    sitedisplay += "\n      SiteLimits:\n";
    sitedisplay += "        is limited to " + siteLimits.MaxConnections.ToString() + " connections.\n";
    sitedisplay += "        with a max bandwidth of " + siteLimits.MaxBandwidth + " bytes/sec.\n";
    sitedisplay += "        timeout of " + siteLimits.ConnectionTimeout + " minutes.\n\n";
}
                testLabel.Text = sitedisplay;

注釈

オブジェクトは SiteLimits 、Web サイトの接続関連の制限を構成します。 このクラスを使用すると、定義した制限を超えてサーバーのリソースにサイトが課税されないようにすることができます。

プロパティ

Attributes

この要素の属性の一覧を含む構成属性コレクションを取得します。

(継承元 ConfigurationElement)
ChildElements

現在の要素のすべての子要素を取得します。

(継承元 ConfigurationElement)
ConnectionTimeout

IIS 7 が接続を非アクティブと見なして終了するまでの待機時間を取得または設定します。

ElementTagName

Web サイトの接続関連の制限を公開します。

(継承元 ConfigurationElement)
IsLocallyStored

構成要素が特定の構成ファイルに格納されているかどうかを示す値を取得します。

(継承元 ConfigurationElement)
Item[String]

指定した名前の属性を取得または設定します。

(継承元 ConfigurationElement)
MaxBandwidth

IIS 7 に使用される最大ネットワーク帯域幅 (1 秒あたりのバイト数) を取得または設定します。

MaxConnections

サーバーへの同時接続の最大数を取得または設定します。

MaxUrlSegments

Web サイトの接続関連の制限を公開します。

Methods

構成要素のメソッドのコレクションを取得します。

(継承元 ConfigurationElement)
RawAttributes

Web サイトの接続関連の制限を公開します。

(継承元 ConfigurationElement)
Schema

現在の要素のスキーマを取得します。

(継承元 ConfigurationElement)

メソッド

Delete()

Web サイトの接続関連の制限を公開します。

(継承元 ConfigurationElement)
GetAttribute(String)

要求された属性を ConfigurationAttribute 表す オブジェクトを返します。

(継承元 ConfigurationElement)
GetAttributeValue(String)

指定した属性の値を返します。

(継承元 ConfigurationElement)
GetChildElement(String)

現在の構成要素の下にあり、指定した名前を持つ子要素を返します。

(継承元 ConfigurationElement)
GetChildElement(String, Type)

現在の構成要素の下にあり、指定した名前と型を持つ子要素を返します。

(継承元 ConfigurationElement)
GetCollection()

現在の構成要素の既定のコレクションを返します。

(継承元 ConfigurationElement)
GetCollection(String)

現在の構成要素に属するすべての構成要素を返します。

(継承元 ConfigurationElement)
GetCollection(String, Type)

指定した名前と型を持ち、現在の構成要素の下にある構成要素を返します。

(継承元 ConfigurationElement)
GetCollection(Type)

指定した型を持ち、現在の構成要素の下にある構成要素を返します。

(継承元 ConfigurationElement)
GetMetadata(String)

要素スキーマからメタデータ値を返します。

(継承元 ConfigurationElement)
SetAttributeValue(String, Object)

指定した属性の値を設定します。

(継承元 ConfigurationElement)
SetMetadata(String, Object)

要素スキーマのメタデータ値を設定します。

(継承元 ConfigurationElement)

適用対象