Question

I have EF4.3.1 installed on my local machine.

I created a new web application project and added the framework. I then created a database/model etc. The framework is split over 2 projects 1 DAL, 1 Entities. On my local machine I'm restricted to SQL Express 2008.

Here is the configuration section from web config:

  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>

Here is the connection string I use:

<add name="PayDayLoanEntities" connectionString="metadata=res://*/Models.PayDayLoans.csdl|res://*/Models.PayDayLoans.ssdl|res://*/Models.PayDayLoans.msl;provider=System.Data.SqlClient;provider connection string='data source=.\SQLEXPRESS;attachdbfilename=&quot;C:\Documents and Settings\John\My Documents\Visual Studio 2010\Projects\IL\WebSite\App_Data\PayDayLoans.mdf&quot;;integrated security=True;connect timeout=30;user instance=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />

All this works!

On my production machine I use SQL 2008 web edition so, changed the connection string as follows:

<add name="PayDayLoanEntities" connectionString="metadata=res://*/Models.PayDayLoans.csdl|res://*/Models.PayDayLoans.ssdl|res://*/Models.PayDayLoans.msl;provider=System.Data.SqlClient;provider connection string='Data Source=localhost;Initial Catalog=PayDayLoans;uid=***;pwd=********&quot;;integrated security=True;connect timeout=30;user instance=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />

However, I get the following error message:

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)

The config section refers to 4.3.1 but the error 4.1.0. Anyone know what I'm missing here?

Any help appreciated.

Was it helpful?

Solution

There's a good chance that something in your solution is referencing EF 4.1.0 when built for RELEASE. Perhaps you have a build server that is not updated properly?

Run Fuslogvw (as Administrator or it will silently fail) on your production machine. Start logging bind failures before you start your web application. Fuslogvw will tell you what exactly tried to bind EF 4.1.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top