[Solved] Could not load file or assembly ‘System.Web.Http Fuslogvw.exe (Assembly Binding Log Viewer)

https://github.com/awaescher/Fusion

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

https://github.com/awaescher/Fusion/releases/download/v1.1/Fusion++.1.1.zip

How to Use 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)

How to Use

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

Example
Searching for the code corresponding to application in the page, I found that there are temporary files, and I need to delete this folder C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\lisa_60_dev_ cmsweb11\931fe700\6226aa26

Delete all the folders and files under application and recompile the project using 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.

How to Close

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

Similar Posts: