I am trying to create a webapi controller, within a site. it is a template controller, nothing changed from what visual studio has inserted.
The code is within an MVC4 site, which runs completely without any errors, however, when I call webapi controller, I am receiving this error:
Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
I have uninstalled EntityFramework nuget package, and when I search in entire solution, it is not found in any file, however, I am repeatedly receiving this error.
Any clues what might be a possible solution to this?
I had the same problem.
All things were working and then just started to give a 404 for all web api requests.
I have tried everything .. the only thing that resolved my issue was to add a reference of EF 4.1.0.0 to my project and also to add it to Web.config.
It strange because nowhere in my solution im using or referencing EF.
I didnt have 4.1 version and I downloaded it from here http://www.microsoft.com/en-us/download/details.aspx?id=26825
I found why EF 4.1 is listed as dependency. The error came only when i wanted to publish the site. And what i did is only to Add Deployable Dependecies and check ASP.NET MVC, because the host server didn't have MVC 4 installed. When i looked on _bin_deployableAssemblies folder

my eye caught System.Web.Http.Data.EntityFramework.dll and immediately i decompiled and voila i found EF 4.1 referenced there.

Arian, I see that error every time I do something with the stock VS template when using EF4.
Turn it around and install Entity Framework again in the solution. Launch the Nuget manager or do it from its console:
Install-Package EntityFramework
(for 4.3.1)
Install-Package EntityFramework -Pre
(for 5.0.0rc)
Once you have the DLL in your references (btw, check that), the error goes away
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With