In order to troubleshoot “Could not load file or assembly” and similar errors, you will need more details to find out the assembly that causes the issue. IIS doesn’t show the binding trace by default but you can enable it manually.
Example for an assembly binding issue:
Could not load file or assembly ‘Oracle.DataAccess’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
Enable Fusion Logs (Assembly Binding Logging)
Enable Fusion Logs so that you can see where the binding is failing. There are two ways to enable it:
- Registry Editor
- Fusion Log Viewer (fuslogvw.exe)
Registry Editor:
- Open Registry Editor
- Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
- Change the value of
EnableLog
to1
. If this key doesn’t exist, create it (DWORD(32-bit)
type)
Other related registry keys:
DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
String LogPath set value to folder for logs (Example: C:\FusionLog\)
Fusion Log Viewer (fuslogvw.exe)
You can also use Microsoft’s Fusion Log Viewer utility (Reference) to enable Fusion Logs. Fusion Log Viewer is installed with Visual Studio. It should be in your “Microsoft SDKs” folder (Example path: C:\Program Files (x86)\Microsoft SDKs\Windows\v{SDK version}A\Bin\FUSLOGVW.exe)
You can also run it by using Visual Studio Command Prompt (Run the command prompt as Administrator):
Steps to enable assembly binding via Fusion Log Viewer:
- Click fuslogvw.exe or run it using Visual Studio Command Prompt
- Click “Settings“
- Select “Log bind failures to disk“
- Check “Enable custom log path“
- Create the directory you want the logs to be recorded in (Example: C:\FusionLogs)
- Enter the path of this folder in “Custom log path” field
- Click “OK“
After enabling it, reproduce the issue. Then click “Refresh” in the Fusion Log Viewer. You should see the binding failure listed. Click “View log” to see more information.
Disable assembly binding logging once you complete troubleshooting because it may affect your server’s performance.
Updated Aug 01, 2019
Version 5.0Nedim
Microsoft
Joined November 26, 2018
IIS Support Blog
Follow this blog board to get notified when there's new activity