Asp. NET project could not load file or assembly problem

Source: Internet
Author: User
Tags bind execution log stack trace

There is a strange problem today, there is a asp.net project that always displays errors that cannot be loaded EF4.1 (references to EF in the project have been upgraded to EF5.0):

Could not load file or assembly ' EntityFramework, version=4.1.0.0, culture=neutral, publickeytoken=b77a5c561934e089 ' or O NE of its dependencies. The located assembly ' s manifest definition does not match the assembly reference. (Exception from hresult:0x80131040)

Description: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code.

Exception Details: System.IO.FileLoadException:Could not load file or assembly ' EntityFramework, version=4.1.0.0, Culture=neutral, publickeytoken=b77a5c561934e089 ' or one of its dependencies. The located assembly ' s manifest definition does not match the assembly reference. (Exception from hresult:0x80131040)

SOURCE Error:

An unhandled exception was generated during the execution of the current WEB request. You can use the following exception stack trace to determine information about the cause of the exception and where it occurred.

Assembly Load Trace: The following information helps determine why the assembly "EntityFramework, version=4.1.0.0, Culture=neutral, publickeytoken=b77a5c561934e089" failed to load.

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

The weird thing is that I'm looking through the whole project code, and I haven't found a place to refer to the entity Framework 4.1.0.0.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

Later, notice the hint in the error message--"dTo enable assembly bind failure logging, set the registry value [hklm\software\microsoft\fusion! Enablelog] (DWORD) to 1 "and think of the log to find out where the EF 4.1 is referenced." Entered the registry a look, there was hklm\software\microsoft\fusion, but no hklm\software\microsoft\fusion! Enablelog. Don't know how to do it?

Search on the Internet, found on the StackOverflow to enable the assembly bind failure Logging (Fusion) in. NET's answer:

Add the following values to

Hkey_local_machine\software\microsoft\fusion

ADD:

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 IE) C:\FusionLog\

This setting is done in the registry:

And then access, the following line is included in the error message displayed on the page:

Calling Assembly:Devtalk.EF.CodeFirst, version=1.0.0.0, Culture=neutral, Publickeytoken=null.

The corresponding log files can also be found in the C:\FusionLog\Default\64baea7c entityframework, version=4.1.0.0, Culture=neutral, publickeytoken= b77a5c561934e089. Htm

So, the truth of the matter--this project refers to Devtalk.EF.CodeFirst.dll, and it references the entity Framework 4.1, which causes this problem.

Update:

If you do not want to generate a log file, just want to display "calling assembly" in the error message, just the registry hkey_local_machine\software\microsoft\ The value of Logresourcebinds is set to 1 (DWORD (32-bit)) in fusion.

Note: You will need to restart IIS after you modify the registry to take effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.