https://github.com/awaescher/Fusion

A modern alternative to the Microsoft Assembly Binding Log Viewer (FUSLOGVW.exe)

https://github.com/awaescher/Fusion/releases/

使用FusLogVw

https://stackoverflow.com/questions/4469929/could-not-load-file-or-assembly-or-one-of-its-dependencies?page=1&tab=votes#tab-top

You can use FusLogVw to find out who is loading the old assemblies, just define a path for the log, and run your solution, then check (in FusLogvw) the first line where the Unity assembly is loaded, double click it and see the calling assembly, and here you go.

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\Developer Command Prompt for VS 2017 (2)

如何使用

Fuslogvw.exe (Assembly Binding Log Viewer)

https://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net/3256753#3256753

I usually use the Fusion Log Viewer (Fuslogvw.exe from a Visual Studio command prompt or Fusion Log Viewer from the start menu) - my standard setup is:

  • Open Fusion Log Viewer as administrator
  • Click settings
  • Check the Enable custom log path checkbox
  • Enter the location you want logs to get written to, for example, c:\FusionLogs (Important: make sure that you have actually created this folder in the file system.)
  • Make sure that the right level of logging is on (I sometimes just select Log all binds to disk just to make sure things are working right)
  • Click OK
  • Set the log location option to Custom

Remember to turn of logging off once you're done!

(I just posted this on a similar question - I think it's relevant here too.)

实例

在页面中搜索application对应的编码,发现存在临时文件,需要将这个文件夹删除C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_cmsweb11\931fe700\6226aa26

将application下面所有的文件夹以及文件删除,然后使用visual studio重新编译项目

*** Assembly Binder Log Entry  (2018/10/31 @ 13:44:32) ***

The operation failed.
Bind result: hr = 0x80131040. No description available. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. === Pre-bind state information ===
LOG: DisplayName = System.Net.Http.Formatting
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Net.Http.Formatting | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/
LOG: Initial PrivatePath = C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_cmsweb11\931fe700
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_cmsweb11\931fe700
LOG: AppName = 6226aa26
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/bin/System.Net.Http.Formatting.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin\System.Net.Http.Formatting.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 5.2.3.0 redirected to 5.2.6.0.
LOG: Post-policy reference: System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: The post-policy assembly reference requires probing again.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/bin/System.Net.Http.Formatting.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin\System.Net.Http.Formatting.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. *** Assembly Binder Log Entry (2018/10/31 @ 13:44:32) *** The operation failed.
Bind result: hr = 0x80131040. No description available. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. === Pre-bind state information ===
LOG: DisplayName = System.Net.Http.Formatting
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Net.Http.Formatting | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/
LOG: Initial PrivatePath = C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_cmsweb11\931fe700
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_cmsweb11\931fe700
LOG: AppName = 6226aa26
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/bin/System.Net.Http.Formatting.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin\System.Net.Http.Formatting.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 5.2.3.0 redirected to 5.2.6.0.
LOG: Post-policy reference: System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: The post-policy assembly reference requires probing again.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/lisa_60_dev_cmsweb11/931fe700/6226aa26/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.
LOG: Attempting download of new URL file:///C:/Users/clu/source/repos/Edenred/LISA_6.0.0.0/Kentico11/LISA.Kentico11/bin/System.Net.Http.Formatting.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\clu\source\repos\Edenred\LISA_6.0.0.0\Kentico11\LISA.Kentico11\bin\System.Net.Http.Formatting.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

如何关闭

Make sure you are running fuslogvw not only as admin but also from the correct Windows SDK path the Visual Studio project throwing the exception is using. Check its csproj and search for SDK within (my sdk node is named TargetFrameworkSDKToolsDirectory). Using a non matching fuslogvw version seems to not catch the exceptions (which makes sense...)

You can run this Powershell script as administrator to enable FL:

Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog         -Value 1               -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath -Value 'C:\FusionLog\' -Type String
mkdir C:\FusionLog -Force

and this one to disable:

Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath

https://indexoutofrange.com/Could_not_load_file_or_assembly_or_one_of_its_dependencies/

这里提供了直接修改注册表的

第二次使用

刚开始启用,发现完全不工作。各种折腾,不知道为啥突然恢复了,可能和执行iisreset有关。也可能是修改注册表导致可用,https://stackoverflow.com/a/1527249

file:///C:/FusionLogs/Default/214332ee/ICSharpCode.SharpZipLib,%20Version=0.85.3.365,%20Culture=neutral,%20PublicKeyToken=1b03e6acf1164f73.htm

分析一下发,发现是因为站点只会加载一次,除非你修改web.config或者替换dll文件,才会再次自动启动。为了测试方便,直接用iisreset来确保站点会被重新加载。

Could not load file or assembly 'System.Web.Http的更多相关文章

  1. ASP.NET MV3 部署网站 报"Could not load file or assembly ' System.Web.Helpers “ 错的解决方法

    转自:http://www.cnblogs.com/taven/archive/2011/08/14/2138077.html 国内很多网站空间都只支持.NET 2.0 和 .NET 3.0 3.5, ...

  2. Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

    提示哪个引用修改哪个引用的属性: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, ...

  3. Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0...

    一.在Mvc 发布时出现如下错误: Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0... 出现错误的原因是 Mvc版本 ...

  4. ex:Could not load file or assembly 'System.Web.Helpers, Version=2.0.0.0, Culture=neutral, . 系统找不到指定的文件。

    今天写的是一个小程序,采用webfrom 形式,.netframework4.0 项目中调用了System.Web.Helpers下的Json方法. 在本地测试没问题,结果搭建到服务器上,死活运行不正 ...

  5. MVC4 部署 could not load file or assembly system.web.http.webhost 或是其它文件出误

    自从VS2010发布之后使用它来做开发的程序员越来越多,其中很多人使用了MVC来作为新的开发框架,但是在系统部署的时候我们也遇到诸多问题,因为目前大多数windows服务器采用的还是Windows S ...

  6. could not load file or assembly "System.Web.Mvc...

    1.一般出现这个错误是因为Web.Config里面的版本号跟project用到的dll版本对应不上 更改webconfig <add assembly="System.Web.Mvc, ...

  7. [Nuget] - "Runtime error: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0'" 问题之解决

    环境 项目中使用了 System.Web.WebPages.Razor, Version=3.0.0.0,Nuget 还原缺失包后自动更新至 Version=3.2.5.0,编译成功,运行失败. 错误 ...

  8. Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not

    因为用了MVC,在本地是没有问题的,但是部署在服务器就出现了这个问题. 出错界面如下图 原因分析:上面的出错提示最后一句话翻译过来.找到的程序集清单定义与程序集引用不匹配.也就是程序引用的程序集版本和 ...

  9. Could not load file or assembly Microsoft.Web.Infrastructure

    Error info:Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=n ...

随机推荐

  1. poj 1061 青蛙的约会(二元一次不定方程)

      Description 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面.它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止.可是它们出发之前忘记了一件很重要 ...

  2. ElasticSearch中辅助API常用用法详解

    本篇是使用Elasticsearch必不可少的必备知识,并且适用于所有的Rest Api. 返回数据格式化 当在Rest请求后面添加?pretty时,结果会以Json格式化的方式显示.另外,如果添加? ...

  3. 安装ubuntu 12.04 后遇到的问题

    我的笔记本是08年的戴尔,比较老的机子了.给本本安装ubuntu/windows8双系统后,ubuntu系统中出现了一些问题,在网上搜寻许多解决方法,管用的就分享一下,顺便做一下记录,免得下次自己又不 ...

  4. STM32 GPIO寄存器 IDR ODR BSRR BRR

    IDR是查看引脚电平状态用的寄存器,ODR是引脚电平输出的寄存器 下面内容的原文:http://m646208823.blog.163.com/blog/static/1669029532012931 ...

  5. SQL2000数据库密码被替换,重置密码提示未能找到存储过程sp_password解决方案

    利用windows身份验证进入查询分析器后在master数据库下运行如下脚本: create procedure sp_password @old sysname = NULL, -- the old ...

  6. 【Android开发—智能家居系列】(一):智能家居原理

    来到JCZB公司的第二天,就接到了开发类似于小米智能家庭APP的任务.组长让我在手机上安装上此款APP,给了我个小米智能插座,就让我开始了解需求.这便开启了我的智能家居旅程.说实话,我也真是out的无 ...

  7. 23. 客户默认选项(Default Customer Options)

    Editing Email Templates Email Sender Contact Us

  8. Sentinel实现Redis高可用

    实现目标: 一主两从,集群起始VIP在master上边,如果当前master挂了,sentinel自动选出一个slave当选master,并把VIP漂移到这台机器,然后把另一台slave指向的mast ...

  9. 使用RPi-Monitor监控、统计Guitar的运行状态

    前言 之前发在ickey社区上的一系列文章: 犹抱琵琶半遮面,无人知是荔枝来--unboxing & interview 一.二.三 葡萄美酒夜光杯,巧妇难为无米炊--资料与社区 一支穿云箭, ...

  10. vue - 前置工作 - 目录功能介绍

    一个DEMOS的完整目录(由于GWF问题,我就不一一打开网站一个个去搜索并且解释了)可以去关注:https://www.cnblogs.com/ye-hcj build build.js(本文来自ht ...