Fuslogvw.exe(組裝綁定日誌檢視器)

組裝綁定日誌檢視器會顯示組裝綁定的詳細資訊。 這些資訊有助於你診斷為什麼 .NET Framework 在執行時無法定位組合語言。 這些失敗通常是因為組件部署到錯誤位置、原生映像檔不再有效,或是版本號或文化不符所致。 通用語言執行時找不到組合語言,通常會在你的應用程式中顯示為 a TypeLoadException 。

這很重要

你必須以管理員權限來執行 fuslogvw.exe。

此工具會自動與 Visual Studio 一起安裝。 要執行此工具,請使用 Visual Studio 開發者命令提示字元或 Visual Studio 開發者 PowerShell 並使用管理員憑證。

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

fuslogvw

檢視器會顯示每個失敗的組裝綁定的項目。 對於每一次失效,觀察者描述:

  • 啟動綁定的應用程式
  • 綁定所用的組合,包括名稱、版本、文化與公開金鑰
  • 故障的日期與時間

怎麼......

更改日誌位置檢視

  1. 選擇 預設 選項按鈕以查看所有應用程式類型的綁定失敗。 預設情況下,日誌條目會儲存在 wininet 快取磁碟上的每位使用者目錄中。

  2. 選擇 自訂選項按鈕 ,即可在你指定的自訂目錄中查看綁定失敗紀錄。 你必須在 日誌設定 對話框中指定執行時要存放日誌的自訂位置,並設定該目錄名稱為有效目錄名稱。 這個目錄應該是乾淨的,只包含執行時產生的檔案。 如果它包含一個會產生無法被記錄失敗的執行檔,該失敗不會被記錄,因為工具會嘗試建立與可執行檔名稱相同的目錄。 此外,嘗試從日誌位置執行執行檔也會失敗。

    備註

    預設的綁定位置比自訂的綁定位置更理想。 執行時會將預設的綁定位置儲存在 wininet 快取中,因此會自動清除。如果你指定自訂綁定位置,你就得負責清理它。

查看特定故障的詳細資訊

  1. 在檢視器中選擇所需項目的應用程式名稱。

  2. 點擊 「查看日誌 」按鈕。 或者,你也可以雙擊選取的條目。

    該工具顯示所選綁定失敗的以下細節:

    • 綁定失敗的具體原因,例如「找不到檔案」或「版本不符」。

    • 關於發起綁定的應用程式的資訊,包括其名稱、應用程式的根目錄(AppBase),以及若有私有搜尋路徑的描述。

    • 工具尋找的組件身份。

    • 描述已套用的任何應用程式、發佈者或管理員版本政策。

    • 是否在 全域組裝快取中找到該組裝。

    • 所有探測網址的清單。

以下範例日誌條目展示了關於組件綁定失敗的詳細資訊。

*** 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/graphicfailtest.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/graphicfailtest.resources/graphicfailtest.resources.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/graphicfailtest.resources.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/graphicfailtest.resources/graphicfailtest.resources.EXE.
LOG: All probing URLs attempted and failed.

刪除條目

要刪除日誌中的單一條目:

  1. 在檢視器中選擇一個項目。

  2. 點擊 刪除條目 按鈕。

要刪除日誌中的所有條目:

  • 點擊 「全部刪除」 按鈕。

刷新使用者介面

  • 點擊 「重新整理 」按鈕。 檢視器在執行時不會自動偵測新的日誌條目。 你必須使用 刷新 按鈕來顯示它們。

更改日誌設定

點擊 設定 按鈕以開啟 日誌設定 對話框。

查看「關於」對話框

點擊 「關於」 按鈕。

原生影像的綁定日誌

預設情況下,Fuslogvw.exe 會記錄一般的組裝綁定請求。 或者,你也可以 記錄用Ngen.exe(原生影像產生器)製作的原生影像的組裝綁定。

原生影像的日誌組合綁定

  • 在 日誌分類 群組中,選擇 「原生圖片 」選項按鈕。

以下日誌顯示因依賴性而導致的失敗,而該相依性在為應用程式建立原生映像時並不存在。 如果執行時的相依關係與執行時的相依不同 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.

日誌設定對話框

你可以使用 日誌設定 對話框執行以下操作。

要停用日誌

  • 選擇「 日誌停用 」選項按鈕。 請注意,這個選項預設是被選擇的。

要在例外中記錄組裝裝置綁定

  • 選擇 「登入例外文字 」選項按鈕。 只有最不詳細的融合日誌資訊會被記錄在例外文字中。 要查看完整資訊,請使用其他設定之一。

    請參閱關於以域中立載入的組件的重要說明。

要記錄組裝綁定失敗

  • 選擇「 日誌綁定失敗到磁碟 」選項按鈕。

    請參閱關於以域中立載入的組件的重要說明。

記錄所有組裝綁定

  • 選擇「 記錄所有綁定到磁碟 」選項按鈕。

    請參閱關於以域中立載入的組件的重要說明。

這很重要

當組件以域中立(domain neutral)載入時,例如將屬性設 LoaderOptimization 為 LoaderOptimization.MultiDomain 或 LoaderOptimization.MultiDomainHost,開啟日誌有時可能會洩漏記憶體。 這種情況可能發生在將域中立模組載入應用域時,日誌紀錄被載入,之後又卸載該應用域。 日誌條目可能要等到流程結束後才會釋出。 有些除錯器會自動開啟日誌。

啟用自訂日誌路徑

  1. 選擇 啟用自訂日誌路徑 選項按鈕。

  2. 將路徑輸入自訂 日誌路徑 文字框。

備註

組合語言綁定日誌檢視器(Fuslogvw.exe)利用網際網路檔案快取來儲存其綁定日誌。 由於快取偶爾損壞, 組合綁定日誌檢視器(Fuslogvw.exe )有時會停止在檢視視窗中顯示新的綁定日誌。 由於此損壞,.NET 綁定基礎架構(fusion)無法寫入或讀取綁定日誌。 (若使用自訂日誌路徑,則不會遇到此問題。)要修復損壞並讓 Fusion 再次顯示綁定日誌,請清除網路檔案快取,方法是刪除網路屬性下的瀏覽 歷史 區塊中的臨時網路檔案。

如果你的非管理應用程式透過實作 IHostAssemblyManager 和 IHostAssemblyStore 介面來承載通用語言執行環境,日誌項目就無法儲存在 wininet 快取中。 要查看實作這些介面的自訂主機的日誌條目,必須指定一條替代日誌路徑。

啟用在 Windows 應用程式容器中執行的應用程式日誌

  1. 啟用自訂日誌路徑,如前述程序所述。 預設情況下,運行在 Windows 應用程式容器中的應用程式對硬碟的存取權限有限。 你指定的目錄會對 App 容器中所有應用程式擁有讀寫權限。

  2. 選擇 啟用沉浸式日誌 的勾選框。

    備註

    此框僅在 Windows 8 或更新版本啟用。

另請參閱