Tuesday, April 5, 2016

WRN: Assembly binding logging is turned OFF.

I recently was working on troubleshooting an ASP.NET MVC Web Application when I suddenly encountered this error message:


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


After doing some digging, I wanted a convenient method of enabling Assembly Logging that would not require me to manually edit the registry.

Of course, my standard go-to for automating tasks is PowerShell!

Therefore, I came up with this PowerShell script to enable Assembly Logging as follows:


$FusionLogDirectory = "C:\FusionLog"

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 $FusionLogDirectory -Type String

If at some point in time, you need to disable Assembly Logging, you can do so with this script:


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

1 comment:


  1. Very informative error.Thank you author for posting this kind of errors .



    http://www.wikitechy.com/fix-error/assembly-binding-logging-is-turned-off



    Both are really good.
    Cheers,
    Venkat

    ReplyDelete