Share via


Application.ApplicationPoolName Eigenschaft

Definition

Ruft den Namen des Anwendungspools ab, dem die Anwendung zugewiesen ist, oder legt diesen fest.

public:
 property System::String ^ ApplicationPoolName { System::String ^ get(); void set(System::String ^ value); };
public string ApplicationPoolName { get; set; }
member this.ApplicationPoolName : string with get, set
Public Property ApplicationPoolName As String

Eigenschaftswert

Der Name des Anwendungspools, dem die Anwendung zugewiesen ist.

Beispiele

Im folgenden Beispiel werden die Konfigurationseinstellungen für eine vorhandene Applicationgelesen. Der Code zeigt den Wert an, der von der ApplicationPoolName -Eigenschaft für die Unter "Standardwebsite" konfigurierten Anwendungen zurückgegeben wird.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class AdministrationApplicationApplicationPoolName
    {
// Writes out the applications and the application pool names 
// associated with the applications under the default Web site.
public void GetApplicationPoolNames()
{
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];

    foreach (Application app in defaultSite.Applications)
    {
        Console.WriteLine(
            "{0} is assigned to the '{1}' application pool.", 
            app.Path, app.ApplicationPoolName);
    }
}
    }
}

Im folgenden Beispiel wird eine neue ApplicationPool und dann eine neue Anwendung erstellt, die dem neu erstellten ApplicationPoolzugewiesen ist.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class AdministrationApplicationApplicationPoolName
    {
// Creates a new application pool and a new application, then 
// assigns the application to the new application pool.
public void SetApplicationPoolName()
{
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];

    ApplicationPool blogPool = 
        manager.ApplicationPools.Add("BlogApplicationPool");
    Application app = defaultSite.Applications.Add(
        "/blogs", @"C:\inetpub\wwwroot\blogs");
    app.ApplicationPoolName = blogPool.Name;
    manager.CommitChanges();
}
    }
}

Hinweise

Für jeden Standort kann ein Standardanwendungspool konfiguriert sein. Wenn ein Anwendungspool nicht explizit für die Anwendung festgelegt ist, gibt die Eigenschaft den ApplicationPoolName Standardnamen des Anwendungspools zurück, der für den Standort konfiguriert wurde. Verwenden Sie die Microsoft.Web.Administration.Site.ApplicationDefaults -Eigenschaft, um die Standardeinstellungen für eine Website anzuzeigen.

Gilt für: