Fuslogvw.exe (組件繫結記錄檔檢視器)

更新:2011 年 4 月

組件繫結記錄檔檢視工具會顯示組件繫結的詳細資料。 這項資訊可以協助您診斷 .NET Framework 為何不能在執行階段時找到組件。 這些失敗通常是由於組件部署至不正確的位置、原生映像已失效,或版本號碼或文化特定不符所致。 Common Language Runtime 找不到組件,通常在應用程式中會顯示為 TypeLoadException

這個工具會自動隨 Visual Studio 和 Windows SDK 一起安裝。 若要執行工具,建議您使用 Visual Studio 命令提示字元或 Windows SDK 命令提示字元。 這些公司可讓您輕鬆地執行工具,而不需瀏覽至安裝資料夾。 如需詳細資訊,請參閱Visual Studio 和 Windows SDK 命令提示字元

  • 如果您已經在電腦上安裝 Visual Studio:在工作列上,依序按一下 Start、All Programs、Visual Studio、Visual Studio Tools,然後按一下 Visual Studio Command Prompt。

    -或-

    如果您已經在電腦上安裝 Windows SDK:在工作列上,依序按一下 Start、All Programs、Windows SDK 的資料夾,然後按一下Command Prompt(或 CMD Shell)。

  • 在命令提示字元中輸入下列文字:

fuslogvw

檢視工具會對每一個失敗的組件繫結顯示一個項目。 對於每一個失敗,檢視工具會描述啟始該繫結的應用程式;所要繫結的組件,包括名稱、版本、文化特性和公開金鑰 (Public Key);以及失敗的日期和時間。

若要變更記錄檔位置檢視

  1. 選取 [預設值] 選項按鈕,以檢視所有應用程式型別的繫結失敗。 根據預設,記錄檔項目會存放在 Wininet 快取之磁碟上的每個使用者目錄。

  2. 選取 [自訂] 選項按鈕來檢視您指定之自訂目錄中的繫結失敗。 透過將 [記錄檔設定] 對話方塊中的設定自訂記錄檔位置設為有效的目錄名稱,您必須指定要執行階段存放記錄檔的自訂位置。 這個目錄應該是乾淨的,只含有執行階段產生的檔案。 如果它含有會產生所要記錄之失敗的可執行檔,這個失敗並不會記錄下來,因為工具會嘗試使用與這個可執行檔同樣的名稱建立一個目錄。 此外,嘗試從記錄檔的位置執行可執行檔將會失敗。

    注意事項注意事項

    預設繫結位置要比自訂繫結位置更合適。Runtime 會將預設繫結位置儲存在 Wininet 快取中,並且會自動清除它。如果您指定自訂的繫結位置,您必須負責清除它。

若要檢視特定失敗的詳細資料

  1. 在檢視工具中選取想要的項目的應用程式名稱。

  2. 按一下 [檢視記錄] 按鈕。 或者,您也可以按兩下選取的項目。

    工具便會顯示所選取繫結失敗的下列詳細資料:

    • 繫結失敗的特定原因,例如「找不到檔案」或「版本不符」。

    • 啟始繫結之應用程式的相關資訊,包括它的名稱、應用程式的根目錄 (AppBase) 以及私用搜尋路徑的描述 (如果有的話)。

    • 工具所搜尋之組件的識別 (Identity)。

    • 已套用之任何應用程式、發行者或系統管理員版本原則的描述。

    • 全域組件快取是否找到組件。

    • 所有探查之 URL 的清單。

以下範例記錄檔項目所示為失敗組件繫結的詳細資訊。

*** Assembly Binder Log Entry  (3/5/2007 @ 12:54:20 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINNT\Microsoft.NET\Framework\v2.0.50727\fusion.dll
Running under executable  C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\graphicfailtest.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : graphicfailtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===

LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources/graphicfailtest.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources/graphicfailtest.resources.EXE.
LOG: All probing URLs attempted and failed.

若要從記錄檔刪除單一項目

  1. 在檢視工具選取項目。

  2. 按一下 [刪除項目] 按鈕。

若要從記錄檔刪除所有項目

  • 按一下 [全部刪除] 按鈕。

若要重新整理使用者介面

  • 按一下 [重新整理] 按鈕。 檢視工具在執行中不會自動偵測新的記錄檔項目。 您必須使用 [重新整理] 按鈕來顯示它們。

若要變更記錄檔設定

  • 按一下 [設定] 按鈕,以開啟 [記錄檔設定] 對話方塊。

若要檢視關於對話方塊

  • 按一下 [關於] 按鈕。

原生映像的繫結記錄檔

根據預設,Fuslogvw.exe 會記錄正常的組件繫結要求。 或者,您可以記錄使用 Ngen.exe (原生映像產生器) 所建立之原生映像的組件繫結。

記錄原生映像的組件繫結

  • 在 [記錄檔分類] 群組中,選擇 [原生映像] 選項 (Option) 按鈕。

下列記錄顯示建立應用程式的原生影像時,不存在的相依性所造成的失敗。 如果執行階段的相依性與執行 Ngen.exe 時的相依性不同,就不允許繫結至原生映像。

*** Assembly Binder Log Entry  (12/8/2006 @ 5:22:07 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  E:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  E:\test\App.exe
--- A detailed error log follows. 

LOG: Start binding of native image App, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: IL assembly loaded from E:\test\App.exe.
LOG: Start validating native image App, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: Start validating all the dependencies.
LOG: [Level 1]Start validating native image dependency mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
LOG: Dependency evaluation succeeded.
LOG: [Level 1]Start validating IL dependency b, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
WRN: Dependency assembly was not found at ngen time, but is found at binding time. Disallow using this native image.
WRN: No matching native image found.
LOG: Bind to native image assembly did not succeed. Use IL image.

下列記錄顯示的原生影像繫結失敗,是由於應用程式執行時電腦上的安全性設定,與原生映像建立時的安全性設定不同所致。

*** Assembly Binder Log Entry  (12/8/2006 @ 5:29:09 PM) ***

The operation failed.
Bind result: hr = 0x80004005. Unspecified error

Assembly manager loaded from:  E:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  E:\test\Application101622.exe
--- A detailed error log follows. 

LOG: Start binding of native image Application101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: IL assembly loaded from E:\test\Application101622.exe.
LOG: Start validating native image Application101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: Start validating all the dependencies.
LOG: [Level 1]Start validating native image dependency mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
LOG: Dependency evaluation succeeded.
LOG: [Level 1]Start validating IL dependency Dependency101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: Dependency evaluation succeeded.
LOG: Validation of dependencies succeeded.
LOG: Start loading all the dependencies into load context.
LOG: Loading of dependencies succeeded.
LOG: Bind to native image succeeded.
Native image has correct version information.
Attempting to use native image E:\Windows\assembly\NativeImages_v2.0.50727_64\Application101622\1ac7fadabec4f72575d807501e9fdc72\Application101622.ni.exe.
Rejecting native image because it failed the security check. The assembly's permissions must have changed since the time it was ngenned, or it is running with a different security context.
Discarding native image.

記錄檔設定對話方塊

您可以使用 [記錄檔設定] 對話方塊執行下列動作。

若要停用記錄

  • 選取 [已停用記錄檔] 選項按鈕。 請注意,預設已選取此選項。

若要記錄例外狀況中的組件繫結

  • 選取 [例外狀況文字中的記錄] 選項按鈕。

    請參閱有關於以定義域中性方式載入之組件的重要注意事項。

若要記錄組件繫結失敗

  • 選取 [記錄磁碟的繫結失敗] 選項按鈕。

    請參閱有關於以定義域中性方式載入之組件的重要注意事項。

若要記錄所有組件繫結

  • 選取 [記錄磁碟的所有繫結] 選項按鈕。

    請參閱有關於以定義域中性方式載入之組件的重要注意事項。

重要事項重要事項

以定義域中性方式載入組件時 (例如,將 LoaderOptimization 屬性設定為 LoaderOptimization.MultiDomainLoaderOptimization.MultiDomainHost),在某些情況下開啟記錄功能可能會遺漏記憶體。如果在將定義域中性模組載入至應用程式定義域時加入了一筆記錄項目,稍後卸載應用程式定義域時,便可能發生這種情況。在處理序 (Process) 結束之前可能都不會發行此記錄項目。有些偵錯工具會自動開啟記錄功能。

若要啟動自訂記錄檔路徑

  1. 選取 [啟用自訂記錄檔路徑] 選項按鈕。

  2. 在 [自訂記錄檔路徑] 文字方塊中輸入路徑。

注意事項注意事項

Fuslogvw.exe (組件繫結記錄檔檢視器) 會使用 Internet Explorer (IE) 快取,以儲存其繫結記錄。由於 IE 快取偶而會損毀,Fuslogvw.exe (組件繫結記錄檔檢視器) 有時可能會不在檢視視窗上顯示新的繫結記錄。由於這種損毀造成的結果,致使 .NET 繫結基礎結構 (融合) 無法寫入繫結記錄或從繫結記錄讀取。(如果您使用自訂記錄路徑,就不會發生這個問題。)若要修復損毀,並讓融合再度顯示繫結記錄,請從 IE 中的 [網際網路選項] 對話方塊,刪除 Temporary Internet files 下的檔案,清除 IE 快取。

如果 Unmanaged 應用程式藉由實作 IHostAssemblyManager 和 IHostAssemblyStore 介面來裝載 (Host) Common Language Runtime,則無法將記錄項目儲存在 Wininet 快取中。若要檢視實作這些介面之自訂主機的記錄項目,必須指定替代的記錄檔路徑。

請參閱

參考

TypeLoadException

Visual Studio 和 Windows SDK 命令提示字元

概念

全域組件快取

執行階段如何找出組件

其他資源

.NET Framework 工具

變更記錄

日期

記錄

原因

2011 年 4 月

加入使用 Visual Studio 和 Windows SDK 命令提示字元的相關資訊。

資訊加強。