共用方式為


ApplicationDomain.PhysicalPath 屬性

定義

取得應用程式域的實體或絕對路徑。

public:
 property System::String ^ PhysicalPath { System::String ^ get(); };
public string PhysicalPath { get; }
member this.PhysicalPath : string
Public ReadOnly Property PhysicalPath As String

屬性值

應用程式域的實體或絕對路徑。

範例

下列範例示範如何檢視所有屬性並卸載應用程式域。

using System;
using Microsoft.Web.Administration;

namespace AdministrationSnippets
{
    public class MicrosoftWebAdministrationApplicationDomain
    {
        ServerManager manager = new ServerManager();

        public void RecycleApplicationDomains()
        {
            Console.WriteLine("Displaying Worker Processes & Application Domains...");
            GetApplicationDomains();
            
            Console.WriteLine("Unloading all application domains");
            UnloadApplicationDomains();

            Console.WriteLine("Displaying Worker Processes & Application Domains with new IDs...");
            GetApplicationDomains();
        }
        public void UnloadApplicationDomains()
        {
            foreach (WorkerProcess proc in manager.WorkerProcesses)
            {
                foreach (ApplicationDomain ad in proc.ApplicationDomains)
                {
                    ad.Unload();
                }
            }
        }
        public void GetApplicationDomains()
        {
            foreach (WorkerProcess proc in manager.WorkerProcesses)
            {
                Console.WriteLine("Worker Process Found:");
                Console.WriteLine("\tProcessId:   {0}", proc.ProcessId);
                Console.WriteLine("\tProcessGuid: {0}", proc.ProcessGuid);
                Console.WriteLine("\tAppPoolName: {0}", proc.AppPoolName);
                Console.WriteLine("\tApplication Domains:");
                foreach (ApplicationDomain ad in proc.ApplicationDomains)
                {
                    Console.WriteLine("\t\tApplication Domain Found:");
                    Console.WriteLine("\t\t{0}", ad.Id );
                    Console.WriteLine("\t\t{0}", ad.VirtualPath );
                    Console.WriteLine("\t\t{0}", ad.PhysicalPath );
                    Console.WriteLine("\t\t{0}", ad.Idle);
                }
            }
        }
    }
}

備註

屬性 PhysicalPath 是唯讀的,而且應用程式域的基礎實體路徑值會在本機快取。 在重新整理或卸載應用程式域之前,不會反映對組態所做的變更。

適用於