Fuslogvw.exe (組件繫結記錄檔檢視器)Fuslogvw.exe (Assembly Binding Log Viewer)

組件繫結記錄檔檢視器會顯示組件繫結的詳細資料。The Assembly Binding Log Viewer displays details for assembly binds. 這項資訊有助於診斷 .NET Framework 為何無法在執行階段找到組件。This information helps you diagnose why the .NET Framework cannot locate an assembly at run time. 這類失敗通常是因為組件部署至不正確的位置、原生映像已失效,或版本號碼或文化特定不符所致。These failures are usually the result of an assembly deployed to the wrong location, a native image that is no longer valid, or a mismatch in version numbers or cultures. 通用語言執行平台找不到組件,通常在應用程式中會顯示為 TypeLoadExceptionThe common language runtime's failure to locate an assembly typically shows up as a TypeLoadException in your application.

重要

您必須以系統管理員權限執行 fuslogvw.exe。You must run fuslogvw.exe with administrator privileges.

此工具會自動與 Visual Studio 一起安裝。This tool is automatically installed with Visual Studio. 若要執行這項工具,請透過系統管理員認證使用 [Visual Studio 開發人員命令提示字元] (或 Windows 7 中的 [Visual Studio 命令提示字元])。To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7) with administrator credentials. 如需詳細資訊,請參閱命令提示字元For more information, see Command Prompts.

在命令提示字元下輸入下列命令:At the command prompt, type the following:

fuslogvw

檢視器會針對每一個失敗的組件繫結顯示一個項目。The viewer displays an entry for each failed assembly bind. 針對每一項失敗,檢視器會描述啟始該繫結的應用程式、所要繫結的組件 (包括名稱、版本、文化特性和公開金鑰),以及失敗的日期和時間。For each failure, the viewer describes the application that initiated the bind; the assembly the bind is for, including name, version, culture and public key; and the date and time of the failure.

若要變更記錄檔位置檢視To change the log location view

  1. 選取 [預設值] 選項按鈕,可檢視所有應用程式類型的繫結失敗。Select the Default option button to view bind failures for all application types. 根據預設,記錄項目會存放在 wininet 快取中磁碟上的每個使用者目錄中。By default, log entries are stored in per-user directories on disk in the wininet cache.

  2. 選取 [自訂] 選項按鈕,可檢視您指定之自訂目錄中的繫結失敗。Select the Custom option button to view bind failures in a custom directory that you specify. 您必須透過將 [記錄檔設定] 對話方塊中的自訂記錄檔路徑設為有效的目錄名稱,指定要讓執行階段存放記錄檔的自訂位置。You must specify the custom location where you want the runtime to store the logs by setting the custom log location in the Log Settings dialog to a valid directory name. 這個目錄應該是乾淨的,只包含執行階段產生的檔案。This directory should be clean, and only contain files that the runtime generates. 如果它包含會產生失敗記錄的可執行檔,則失敗將不會記錄下來,因為工具會嘗試使用與該可執行檔相同的名稱建立目錄。If it contains an executable that generates a failure to be logged, the failure will not be logged because the tool tries to create a directory with the same name as the executable. 此外,嘗試從記錄檔位置執行可執行檔將會失敗。In addition, an attempt to run an executable from the log location will fail.

    注意

    預設繫結位置要比自訂繫結位置更合適。The default bind location is preferable to the custom bind location. 執行時間會將預設系結位置儲存在 wininet 快取中,因此會自動將其清除。如果您指定自訂系結位置,就會負責將它清除。The runtime stores the default bind location in the wininet cache, and therefore automatically cleans it out. If you specify a custom bind location, you are responsible for cleaning it out.

若要檢視特定失敗的詳細資料To view details about a specific failure

  1. 在檢視器中選取所需項目的應用程式名稱。Select the application name of the desired entry in the viewer.

  2. 按一下 [檢視記錄檔] 按鈕。Click the View Log button. 或者,您也可以按兩下選取的項目。Alternately, you can double-click the selected entry.

    工具便會顯示有關所選取繫結失敗的下列詳細資料:The tool displays the following details about the selected bind failure:

    • 繫結失敗的特定原因,例如「找不到檔案」或「版本不符」。The specific reason the bind failed, such as "file not found" or "version mismatch".

    • 啟始繫結之應用程式的相關資訊,包括其名稱、應用程式的根目錄 (AppBase) 以及私用搜尋路徑的描述 (如果有的話)。Information about the application that initiated the bind, including its name, the application's root directory (AppBase), and a description of the private search path, if there is one.

    • 工具所搜尋之組件的識別。The identity of the assembly the tool is looking for.

    • 已套用之任何應用程式、發行者或系統管理員版本原則的描述。A description of any Application, Publisher, or Administrator version policies that have been applied.

    • 全域組件快取中是否找到組件。Whether the assembly was found in the global assembly cache.

    • 所有探查 URL 的清單。A list of all probing URLs.

以下範例記錄項目將顯示失敗之組件繫結的詳細資訊。The following sample log entry shows detailed information about a failed assembly bind.

*** 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.

若要從記錄檔刪除單一項目To delete a single entry from the log

  1. 在檢視器中選取項目。Select an entry in the viewer.

  2. 按一下 [刪除項目] 按鈕。Click the Delete Entry button.

若要從記錄檔刪除所有項目To delete all entries from the log

  • 按一下 [全部刪除] 按鈕。Click the Delete All button.

若要重新整理使用者介面To refresh the user interface

  • 按一下 [重新整理] 按鈕。Click the Refresh button. 檢視器在執行時不會自動偵測新的記錄項目。The viewer does not automatically detect new log entries while it is running. 您必須使用 [重新整理] 按鈕才能顯示新項目。You must use the Refresh button to display them.

若要變更記錄檔設定To change the log settings

  • 按一下 [設定] 按鈕,開啟 [記錄檔設定] 對話方塊。Click the Settings button to open the Log Settings dialog.

若要檢視關於對話方塊To view the About dialog

  • 按一下 [關於] 按鈕。Click the About button.

原生映像的繫結記錄檔Binding Logs for Native Images

根據預設,Fuslogvw.exe 會記錄正常的組件繫結要求。By default, Fuslogvw.exe logs normal assembly bind requests. 或者,您可以記錄使用 Ngen.exe (原生映像產生器) 所建立之原生映像的組件繫結。Alternatively, you can log assembly binds for native images that were created using the Ngen.exe (Native Image Generator).

若要記錄原生映像的組件繫結To log assembly binds for native images

  • 在 [記錄檔分類] 群組中,選取 [原生映像] 選項按鈕。In the Log Categories group, select the Native Images option button.

下列記錄將顯示建立應用程式的原生影像時,不存在的相依性所造成的失敗。The following log shows a failure caused by a dependency that did not exist when the native image was created for the application. 如果執行階段的相依性與 Ngen.exe 執行時的相依性不同,則不允許繫結至原生映像。If the dependencies at run time differ from the dependencies when Ngen.exe is run, binding to a native image is not allowed.

*** 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.

下列記錄檔顯示的原生映像繫結失敗,是由於應用程式執行時電腦上的安全性設定,與原生映像建立時的安全性設定不同所致。The following log shows a native image binding failure that occurred because the security settings on the computer when the application was run were different from the security settings at the time the native image was created.

*** 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.

[記錄檔設定] 對話方塊The Log Settings Dialog

您可以使用 [記錄檔設定] 對話方塊執行下列動作。You can use the Log Settings dialog to perform the following actions.

若要停用記錄To disable logging

  • 選取 [停用記錄] 選項按鈕。Select the Log disabled option button. 請注意,這個選項預設為選取狀態。Note that this option is selected by default.

若要記錄例外狀況中的組件繫結To log assembly binds in exceptions

  • 選取 [在例外狀況文字中記錄] 選項按鈕。Select the Log in exception text option button. 例外狀況文字中只會記錄最簡要的融合記錄資訊。Only the least detailed fusion log information is logged in exception text. 若要檢視完整資訊,請使用其中一項其他設定。To view full information, use one of the other settings.

    請參閱有關以定義域中性方式載入之組件的<重要事項>。See the Important note regarding assemblies that are loaded as domain neutral.

若要記錄組件繫結失敗To log assembly bind failures

  • 選取 [在磁碟中記錄失敗的繫結] 選項按鈕。Select the Log bind failures to disk option button.

    請參閱有關以定義域中性方式載入之組件的<重要事項>。See the Important note regarding assemblies that are loaded as domain neutral.

若要記錄所有組件繫結To log all assembly binds

  • 選取 [在磁碟中記錄所有繫結] 選項按鈕。Select the Log all binds to disk option button.

    請參閱有關以定義域中性方式載入之組件的<重要事項>。See the Important note regarding assemblies that are loaded as domain neutral.

重要

以定義域中性方式載入組件時 (例如,將 LoaderOptimization 屬性設定為 LoaderOptimization.MultiDomainLoaderOptimization.MultiDomainHost),開啟記錄功能在某些情況下可能會造成記憶體流失。When an assembly is loaded as domain neutral, for example by setting the LoaderOptimization property to LoaderOptimization.MultiDomain or LoaderOptimization.MultiDomainHost, turning on logging might leak memory in some cases. 如果在將定義域中性模組載入至應用程式定義域時加入一筆記錄項目,稍後卸載應用程式定義域時,便可能發生這種情況。This can happen if a log entry is made when a domain-neutral module is loaded into an application domain, and later the application domain is unloaded. 在處理序結束之前,可能都不會發行這個記錄項目。The log entry might not be released until the process ends. 有些偵錯工具會自動開啟記錄功能。Some debuggers automatically turn on logging.

若要啟用自訂記錄檔路徑To enable a custom log path

  1. 選取 [啟用自訂的記錄檔路徑] 選項按鈕。Select the Enable custom log path option button.

  2. 在 [自訂的記錄檔路徑] 文字方塊中輸入路徑。Enter the path into the Custom log path text box.

注意

組件繫結記錄檔檢視器 (Fuslogvw.exe) 使用 Internet Explorer (IE) 快取來儲存其繫結記錄檔。The Assembly Binding Log Viewer (Fuslogvw.exe) uses the Internet Explorer (IE) cache to store its binding log. 由於 IE 快取偶爾會損毀,因此組件繫結記錄檔檢視器 (Fuslogvw.exe) 有時可能會停止在檢視視窗內顯示新的繫結記錄檔。Due to occasional corruption in the IE cache, the Assembly Binding Log Viewer (Fuslogvw.exe) can sometimes stop showing new binding logs in the viewing window. 這種損毀導致 .NET 繫結基礎結構 (融合) 無法寫入繫結記錄檔或從繫結記錄檔讀取As a result of this corruption, the .NET binding infrastructure (fusion) cannot write to or read from the binding log. (如果您使用自訂記錄檔路徑,就不會發生此問題)。 若要修正損毀,並允許融合再次顯示系結記錄檔,請從 [IE 網際網路選項] 對話方塊中刪除 [網際網路上的暫存檔案],以清除 IE 快取。(This issue is not encountered if you use a custom log path.) To fix the corruption and allow fusion to show binding logs again, clear the IE cache by deleting temporary internet files from within the IE Internet Options dialog.

如果 Unmanaged 應用程式藉由實作 IHostAssemblyManagerIHostAssemblyStore 介面裝載 Common Language Runtime,則無法將記錄項目儲存在 wininet 快取中。If your unmanaged application hosts the common language runtime by implementing the IHostAssemblyManager and IHostAssemblyStore interfaces, log entries can't be stored in the wininet cache. 若要檢視實作這些介面之自訂主機的記錄項目,則必須指定替代的記錄檔路徑。To view log entries for custom hosts that implement these interfaces, you must specify an alternate log path.

若要啟用在 Windows 應用程式容器中執行的應用程式記錄功能To enable logging for apps running in the Windows app container

  1. 啟用自訂的記錄檔路徑,如上述程序所述。Enable a custom log path, as described in the previous procedure. 根據預設,在 Windows 應用程式容器中執行的應用程式對硬碟的存取權會受到限制。By default, apps that are running in the Windows app container have limited access to the hard disk. 您指定的目錄將可以對應用程式容器中的所有應用程式進行讀取/寫入。The directory you specify will have read/write access for all apps in the app container.

  2. 選取 [啟用擬真記錄] 核取方塊。Select the Enable immersive logging check box.

    注意

    只有在 Windows 8 (含) 以後版本中才會啟用這個方塊。This box is enabled only on Windows 8 or later.

請參閱See also