Fuslogvw.exe (程序集绑定日志查看器)

程序集绑定日志查看器显示程序集绑定的详细信息。 此信息有助于诊断 .NET Framework 在运行时找不到程序集的原因。 这些失败通常是部署到错误位置的程序集、不再有效的本机映像或版本号或区域性不匹配的结果。 公共语言运行时未能找到程序集通常显示为 TypeLoadException 应用程序中的程序集。

重要

必须使用管理员权限运行 fuslogvw.exe。

此工具会自动随 Visual Studio 一起安装。 若要运行该工具,请使用 Visual Studio 开发人员命令提示符或 Visual Studio 开发人员 PowerShell 和管理员凭据。

在命令提示符处,输入下列命令:

fuslogvw

查看器显示每个失败程序集绑定的条目。 对于每个失败,查看器描述了:

  • 启动绑定的应用程序
  • 绑定用于的程序集,包括名称、版本、区域性和公钥
  • 失败的日期和时间

如何。。。

更改日志位置视图

  1. 选择 “默认 ”选项按钮以查看所有应用程序类型的绑定失败。 默认情况下,日志条目存储在 wininet 缓存中磁盘上的每用户目录中。

  2. 选择“ 自定义 ”选项按钮以查看指定的自定义目录中的绑定失败。 必须通过将 日志设置 对话框中的自定义日志位置设置为有效的目录名称来指定运行时要在其中存储日志的自定义位置。 此目录应是干净的,并且仅包含运行时生成的文件。 如果它包含生成失败的可执行文件,则不会记录失败,因为该工具尝试创建与可执行文件同名的目录。 此外,尝试从日志位置运行可执行文件将失败。

    注释

    默认绑定位置优于自定义绑定位置。 运行时将默认绑定位置存储在 wininet 缓存中,因此会自动将其清除。如果指定自定义绑定位置,则需负责将其清除。

查看有关特定失败的详细信息

  1. 在查看器中选择所需条目的应用程序名称。

  2. 单击“ 查看日志 ”按钮。 或者,可以双击所选条目。

    该工具显示有关所选绑定失败的以下详细信息:

    • 绑定失败的特定原因,例如“找不到文件”或“版本不匹配”。

    • 有关启动绑定的应用程序的信息,包括其名称、应用程序的根目录(AppBase)以及专用搜索路径的说明(如果有)。

    • 该工具要查找的程序集的标识。

    • 已应用的任何应用程序、发布服务器或管理员版本策略的说明。

    • 程序集是否在 全局程序集缓存中找到。

    • 所有探测 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/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.

“日志设置”对话框

可以使用 “日志设置” 对话框执行以下作。

禁用日志记录

  • 选择 “日志禁用 ”选项按钮。 请注意,此选项默认处于选中状态。

记录异常中的程序集绑定

  • 选择“ 登录异常文本 ”选项按钮。 只有最详细的融合日志信息以异常文本记录。 若要查看完整信息,请使用其他设置之一。

    有关作为非域加载的程序集,请参阅重要说明。

记录程序集绑定失败

  • 选择 “日志绑定到磁盘 ”选项按钮的日志绑定失败。

    有关作为非域加载的程序集,请参阅重要说明。

记录所有程序集绑定

  • 选择 “日志所有绑定到磁盘 ”选项按钮。

    有关作为非域加载的程序集,请参阅重要说明。

重要

将程序集加载为非特定域时,例如,将属性LoaderOptimization.MultiDomain设置为LoaderOptimizationLoaderOptimization.MultiDomainHost启用日志记录时,在某些情况下可能会泄漏内存。 如果将非特定域模块加载到应用程序域中,然后卸载应用程序域,则可能会发生这种情况。 在进程结束之前,可能不会释放日志条目。 某些调试器会自动打开日志记录。

启用自定义日志路径

  1. 选择“ 启用自定义日志路径 ”选项按钮。

  2. “自定义日志路径 ”文本框中输入路径。

注释

程序集绑定日志查看器(Fuslogvw.exe)使用 Internet 文件缓存来存储其绑定日志。 由于缓存中偶尔损坏, 程序集绑定日志查看器(Fuslogvw.exe) 有时会停止在查看窗口中显示新的绑定日志。 由于此损坏,.NET 绑定基础结构(fusion)无法写入或读取绑定日志。 (如果使用自定义日志路径,则不会遇到此问题。若要修复损坏并允许融合再次显示绑定日志,请通过从 Internet 属性下的 “浏览历史记录 ”部分删除临时 Internet 文件来清除 Internet 文件缓存。

如果非托管应用程序通过实现 IHostAssemblyManagerIHostAssemblyStore 接口托管公共语言运行时,则日志条目无法存储在 wininet 缓存中。 若要查看实现这些接口的自定义主机的日志条目,必须指定备用日志路径。

为在 Windows 应用容器中运行的应用启用日志记录

  1. 如前面的过程中所述启用自定义日志路径。 默认情况下,在 Windows 应用容器中运行的应用对硬盘的访问权限有限。 指定的目录将具有应用容器中所有应用的读/写访问权限。

  2. 选中“ 启用沉浸式日志记录 ”复选框。

    注释

    此框仅在 Windows 8 或更高版本上启用。

另请参阅