Project Builds Successfully, web site gives 404 but no crash

Topics: Troubleshooting, Writing modules
Aug 16, 2013 at 9:17 PM
I added references to the Entity Framework in a module I created. Rebuilding the entire solution and then building the project will cause the website to run until any attempt to interact with a portion of that module.

Running the solution in debugger mode throws several exceptions that orchard had an error loading my extension.

A list of the changes I made:
  1. Added references to entity framework in both my module and Orchard.Web projects.
  2. Added .EDMX file to the module
  3. Added code that referenced the .EDMX to the module
  4. Modified the web.config files of both the module and Orchard.Web to include the windows authentication connection strings for the .EDMX
I have tried:
  1. Excluding the .EDMX from the solution and removing all references to it.
  2. Removing all code that was added between the working state and the current state.
  3. Removing all Entity framework references in my project and Orchard.Web
to no avail.
Aug 16, 2013 at 10:33 PM
Are you able to determine the subject of the 404? That is, what object is being requested but not found?
Developer
Aug 18, 2013 at 1:44 AM
Also check your log files in App_Data/Logs. What exceptions are you seeing?
Aug 19, 2013 at 3:22 PM
Edited Aug 19, 2013 at 3:23 PM
PunzunLtd wrote:
Are you able to determine the subject of the 404? That is, what object is being requested but not found?
No, all I know is that the module I created failed to load so I am assuming it is the model object from that module.

sfmskywalker wrote:
Also check your log files in App_Data/Logs. What exceptions are you seeing?
2013-08-16 15:13:09,543 [10] Orchard.Environment.Extensions.ExtensionManager - Error loading extension 'TheModuleIMade'
System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.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)
and
2013-08-16 15:13:09,547 [8] Orchard.Environment.DefaultOrchardHost - A tenant could not be started: Default
System.AggregateException: One or more errors occurred. ---> Orchard.OrchardException: Error while loading extension 'Project'. ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.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)
seem to be making regular appearances. Does the entity framework not play nicely with orchard? I copied it into the module folder and added the reference but that appears to be the issue with the first exception.
Aug 19, 2013 at 3:50 PM
Okay some more light on the issue: adding the reference to the entity framework does not cause the site to crash on load but attempting to use an EDMX that references that framework WILL cause the site to crash.
Aug 19, 2013 at 3:55 PM
It seems that version 4.4.0.0 of EF was found, but you are probably requesting a different version. This doesn't seem to be an Orchard related error. You should check what version you are referencing (in your web.config file) and why the 4.4.0.0 version is found instead (GAC maybe?).

See also
Aug 19, 2013 at 4:04 PM
Edited Aug 19, 2013 at 4:11 PM
The error is that it is trying to load entity framework 4.4.0.0 when the version of the DLL source folder is 5.0.0.0

I changed all references of 4.4 to 5.0 but the error is still propagating in the log file claiming it is trying to load 4.4. Will continue reading up on this error.
Aug 19, 2013 at 4:52 PM
Edited Aug 19, 2013 at 4:52 PM
Issue Solved. The problem is that Orchard.Framework.Environment was referencing an older version of the Entity Framework. Apparently multiple references to the framework will cause it to break if they are not the same version.
Developer
Aug 19, 2013 at 10:08 PM
@Bryan Try setting up assembly binding redirects in web.config. This way you won't have problems with different version references in the future.