AppDomainSetup.ApplicationBase Property

Definition

Ruft den Namen des Verzeichnisses ab, das die Anwendung enthält, oder legt diesen fest.Gets or sets the name of the directory containing the application.

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

Property Value

String

Der Name des Basisverzeichnisses der Anwendung.The name of the application base directory.

Implements

Examples

Im folgenden Beispiel wird veranschaulicht, wie die ApplicationBase-Eigenschaft verwendet wird, um den Speicherort festzulegen, an dem das assemblylade Modul beginnt, die Assemblys in eine neue Anwendungsdomäne zuThe following example demonstrates how to use the ApplicationBase property to set the location where the assembly loader begins probing for assemblies to load into a new application domain.

Note

Sie müssen sicherstellen, dass der angegebene Ordner vorhanden ist.You must ensure that the folder you specify exists.

using namespace System;

int main()
{
    AppDomain^ root = AppDomain::CurrentDomain;

    AppDomainSetup^ setup = gcnew AppDomainSetup();
    setup->ApplicationBase = 
        root->SetupInformation->ApplicationBase + "MyAppSubfolder\\";

    AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup);

    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        root->FriendlyName, root->SetupInformation->ApplicationBase);
    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        domain->FriendlyName, domain->SetupInformation->ApplicationBase);

    AppDomain::Unload(domain);
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
using System;

class ADSetupInformation
{
    static void Main()
    {
        AppDomain root = AppDomain.CurrentDomain;

        AppDomainSetup setup = new AppDomainSetup();
        setup.ApplicationBase =
            root.SetupInformation.ApplicationBase + @"MyAppSubfolder\";

        AppDomain domain = AppDomain.CreateDomain("MyDomain", null, setup);

        Console.WriteLine("Application base of {0}:\r\n\t{1}",
            root.FriendlyName, root.SetupInformation.ApplicationBase);
        Console.WriteLine("Application base of {0}:\r\n\t{1}",
            domain.FriendlyName, domain.SetupInformation.ApplicationBase);

        AppDomain.Unload(domain);
    }
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
Class ADSetupInformation

    Shared Sub Main()

        Dim root As AppDomain = AppDomain.CurrentDomain

        Dim setup As New AppDomainSetup()
        setup.ApplicationBase = _
            root.SetupInformation.ApplicationBase & "MyAppSubfolder\"

        Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", Nothing, setup)

        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            root.FriendlyName, root.SetupInformation.ApplicationBase)
        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            domain.FriendlyName, domain.SetupInformation.ApplicationBase)

        AppDomain.Unload(domain)
    End Sub
End Class

' This example produces output similar to the following:
'
'Application base of MyApp.exe:
'        C:\Program Files\MyApp\
'Application base of MyDomain:
'        C:\Program Files\MyApp\MyAppSubfolder\

Remarks

Das Anwendungs Basisverzeichnis ist der Ort, an dem der assemblymanager die Suche nach Assemblys startetThe application base directory is where the assembly manager begins probing for assemblies.

Die ApplicationBase-Eigenschaft kann Einfluss darauf haben, welche Berechtigungen einer Anwendungsdomäne gewährt werden.The ApplicationBase property can influence which permissions are granted to an application domain. Beispielsweise erhält eine Anwendungsdomäne, die auf dem lokalen computerbasiert, normalerweise die volle Vertrauenswürdigkeit basierend auf dem Ursprungs Standort.For example, an application domain originating from the local computer normally receives full trust based on its location of origin. Wenn die ApplicationBase-Eigenschaft der AppDomain jedoch auf den vollständigen Namen eines Intranetverzeichnisses festgelegt ist, schränkt ApplicationBase die Einstellung für die Einstellung der Anwendungsdomäne die Berechtigungen auf eine LocalIntranet-Gewährung ein, auch wenn die Anwendungsdomäne tatsächlich vom lokalen Computer stammt.However, if the ApplicationBase property of that AppDomain is set to the full name of an intranet directory, the ApplicationBase setting restricts the permissions granted to the application domain to a LocalIntranet grant even though the application domain actually originates from the local computer.

Applies to