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


    程序集绑定日志查看器显示程序集绑定的详细信息。这些信息有助于您诊断 .NET Framework 无法在运行时找到程序集的原因。这些失败通常由以下因素导致:部署到错误位置的程序集、不再有效的本机映像或者版本号或区域性不匹配。如果公共语言运行库未能找到程序集,则通常会在您的应用程序中表现为 TypeLoadException

    查看程序集绑定日志的内容

    查看器将为每次失败的程序集绑定显示一项。对于每次失败,查看器会描述启动该绑定的应用程序,绑定所针对的程序集(包括名称、版本、区域性和公钥),以及失败的日期和时间。

    更改日志位置视图

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

    2. 选择“Custom”选项按钮可以在您指定的自定义目录中查看绑定失败信息。必须指定您希望运行库存储日志的自定义位置,方法是在“Log Settings”对话框中设置自定义日志位置,将其设置为有效的目录名。此目录应是干净的,并且仅包含运行库所生成的文件。如果该目录中包含了一个会生成可被记录下来的失败的可执行文件,则该失败将不会被记录下来,因为此工具试图创建一个与该可执行文件同名的目录。此外,试图从日志位置运行可执行文件时也会失败。

      说明:

      默认的绑定位置优于自定义绑定位置。运行库将默认绑定位置存储在 wininet 缓存中,因而可以自动清除该位置。如果您指定了自定义绑定位置,则需要自行将其清除。

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

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

    2. 单击“View Log”按钮。或者,可以双击所选项。

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

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

      • 与启动该绑定的应用程序有关的信息,包括其名称、应用程序的根目录 (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/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. 单击“Delete Entry”按钮。

    从日志中删除所有项

    • 单击“Delete All”按钮。

    刷新用户界面

    • 单击“刷新”按钮。查看器在其运行时不自动检测新的日志项。您必须使用“Refresh”按钮来显示它们。

    更改日志设置

    • 单击“Settings”按钮打开“Log Settings”对话框。

    查看“About”对话框

    • 单击“About”按钮。

    默认情况下,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.

    可以使用“Log Settings”对话框执行下列操作。

    禁用日志记录

    • 选择“Log disabled”选项按钮。 注意,默认情况下此选项处于选中状态。

    在异常中记录程序集绑定

    • 选择“Log in exception text”选项按钮。

      请参见有关以非特定域方式加载的程序集的“重要事项”说明。

    记录程序集绑定失败

    • 选择“Log bind failures to disk”选项按钮。

      请参见有关以非特定域方式加载的程序集的“重要事项”说明。

    记录所有程序集绑定

    • 选择“Log all binds to disk”选项按钮。

      请参见有关以非特定域方式加载的程序集的“重要事项”说明。

    重要说明:

    当程序集以非特定域方式加载时(例如,将 LoaderOptimization 属性设置为 LoaderOptimization..::.MultiDomainLoaderOptimization..::.MultiDomainHost),打开日志记录可能会在某些情况下泄露内存。如果在将非特定于域的模块载入一个应用程序域时记录日志条目,随后又卸载该应用程序域,就可能发生内存泄露。在进程结束前可能将不会释放该日志条目。一些调试器会自动打开日志记录。

    启用自定义日志路径

    1. 选择“Enable custom log path”选项按钮。

    2. “Custom log path”文本框中输入路径。

    说明:

    程序集绑定日志查看器 (Fuslogvw.exe) 使用 Internet Explorer (IE) 缓存来存储其绑定日志。由于 IE 缓存中偶尔会出现损坏,因此 程序集绑定日志查看器 (Fuslogvw.exe) 有时会停止在查看窗口中显示新的绑定日志。受此损坏的影响,.NET 绑定基础结构(合成)将无法写入或读取绑定日志。(如果使用自定义日志路径,则不会遇到此问题。) 若要修复损坏的数据,并允许合成再次显示绑定日志,请在 IE 的“Internet 选项”对话框中删除临时的 Internet 文件,以清除 IE 缓存。

    如果非托管应用程序通过实现 IHostAssemblyManagerIHostAssemblyStore 接口成为公共语言运行库的宿主,则不能将日志条目存储在 wininet 缓存中。 若要查看实现这些接口的自定义宿主的日志条目,必须指定替代日志路径。

  • 相关阅读:
    JavaScript监听、设置全部ajax访问属性获取返回值(状态码)
    如何在Vue项目中使用vw实现移动端适配
    git 常用命令金字教程
    移动web开发之像素和DPR详解
    小程序-微信开发者工具使用
    小程序开发框架:Taro(一)基础篇
    vscode代码自动补全失效
    JS、C#编码解码
    PHP网页缓存技术
    ajaxfileupload回到json带<pre>
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1380583.html
Copyright © 2020-2023  润新知