更新:2007 年 11 月
Windows Presentation Foundation (WPF) Host (PresentationHost.exe) 是一套應用程式,能夠讓 WPF 應用程式裝載於相容的瀏覽器中 (包含 Windows Internet Explorer 7 和 Microsoft Internet Explorer 6)。根據預設,Windows Presentation Foundation (WPF) Host 會註冊為 Shell 和 MIME 處理常式,適用於瀏覽器裝載的 WPF 內容,其中包含:
鬆散 (未壓縮的) XAML 檔案 (.xaml)
XAML 瀏覽器應用程式 (XBAP) (.xbap)
對於這些檔案類型,Windows Presentation Foundation (WPF) Host 會:
啟動已註冊的 HTML 處理常式,以裝載 Windows Presentation Foundation (WPF) 內容。
載入正確版本的必要 Common Language Runtime (CLR) 和 Windows Presentation Foundation (WPF) 組件 (Assembly)。
確定已備妥部署區域的適當使用權限等級。
本主題說明可用於 PresentationHost.exe 的命令列參數。
使用方式
PresentationHost.exe [parameters] uri|filename
參數
參數 |
描述 |
|---|---|
filename |
要啟動之檔案的路徑。也可以是 URI。 |
-debug |
啟動應用程式時,不從存放區進行認可或執行。啟動本機檔案時,此參數才有作用。 |
-debugSecurityZoneURL <url> |
與 URL 值搭配使用,以指示 PresentationHost.exe 有個應用程式應予以偵錯,就猶如從指定的 URL 進行部署一般。此參數可同時決定部署區域與來源網站。 |
-embedding |
OLE 的必要參數。如果已指定 -event 或 -debug 參數,則不需指定 -embedding 參數,因為該參數已在內部設定。 |
-event <eventname> |
開啟具有此名稱的事件,並在 PresentationHost.exe 已初始化且準備裝載 WPF 內容時發出信號。如果在開啟此事件時發生錯誤 (例如,此事件尚未建立),PresentationHost.exe 就會結束。 |
案例
Shell 處理常式
PresentationHost.exe example.xbap
MIME 處理常式
PresentationHost.exe -embedding example.xbap
Visual Studio 偵錯
PresentationHost.exe -debug example.xbap
Visual Studio 區域偵錯
PresentationHost.exe -debug -debugSecurityZoneURL http://www.example.com example.xbap