How can I enable Assembly binding logging?

2019-01-21 05:39发布

I'm getting, "Could not load file or assembly 'Bla' or one of its dependencies. An attempt was made to load a program with an incorrect format."

A portion of the detailed info says:

"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]."

So, thinking this may give me some insight in why I'm getting the error above (maybe the next YSOD would contain more explicit information about exactly why it's failing), I navigated to that location in the registry, but there is no such key that I can see. What it does have is:

\Fusion 
    (Default)   value not set
    \GACChangeNotification
    \NativeImagesIndex
    \PublisherPolicy

What am I missing?

8条回答
孤傲高冷的网名
2楼-- · 2019-01-21 06:07

Just create a new DWORD(32) under the Fusion key. Name the DWORD to EnableLog, and set it to value 1. Then restart IIS, refresh the page giving errors, and the assembly bind logs will show in the error message.

查看更多
Root(大扎)
3楼-- · 2019-01-21 06:11
  1. Create a new Application Pool

  2. Go to the Advanced Settings of this application pool

  3. Set the Enable 32-Bit Application to True

  4. Point your web application to use this new Pool

Screenshot (IIS-ApplicationPool)

查看更多
爷的心禁止访问
4楼-- · 2019-01-21 06:16

Per pierce.jason's answer above, I had luck with:

Just create a new DWORD(32) under the Fusion key. Name the DWORD to LogFailures, and set it to value 1. Then restart IIS, refresh the page giving errors, and the assembly bind logs will show in the error message.

查看更多
Summer. ? 凉城
5楼-- · 2019-01-21 06:16

If you sometimes run different versions of your application, make sure you delete 'Bla' from the application bin directory if the version running doesn't need it.

查看更多
祖国的老花朵
6楼-- · 2019-01-21 06:16

For me the 'Bla' file was System.Net.http dll which was missing from my BIN folder. I just added it and it worked fine. Didn't change any registry key or anything of that sort.

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-21 06:17

Instead of Creating New Application Pool,You can go to your Existing application Pool->Right click Advance setting->Enable 32-bit Application-----Set to TRUE

查看更多
登录 后发表回答