ASP.NET: Could not load file or assembly 'xxxx' or one of its dependencies. An attempt was made to load a program with an incorrect format. On windows 7 64bit, IIS 7

黄页错误提示:

Server Error in '/' Application.

Could not load file or assembly 'WL.Log' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'WL.Log' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'WL.Log' could not be loaded.

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

 

今天在IIS7上部署ASP.Net MVC的网站时候,总是碰到如题所示黄页错误。因为之前,在IIS7上部署过没有这种错误。依据错误提示,我做了如下几点尝试:

1. 怀疑真如错误信息提示的那样,对于这个程序集‘WL.Log.dll’加载有问题。由于在VS自带的DevIIS运行正常,所以我重新发布了一次。但遗憾的是,问题依旧存在;

2.根据WRN信息,打开regedit.exe找[HKLM\Software\Microsoft\Fusion!EnableLog],但是没有发现Fusion!EnableLog的Key,所以也没有成功;

3.这种情况下,我只能借助Google了,直到发现了这篇文章,找到解决方案。问题就出在,我现在的操作系统是win7 sp1 x64,所以之前,在x86的操作系统中,同样的操作并没有遇到这种问题。

解决方案:

①当前网站打开【高级设置】选项;

image24

 

②在【高级设置】窗口中找到【一般】下的【允许32位应用程序】设置为True,确认。

image_thumb14

③【重启】网站,运行正常。

posted @ 2012-05-03 10:45  斯洛波维亚  阅读(720)  评论(0编辑  收藏  举报