ASP.NET MVC MiniProfiler and EntityFramework 6 Initialization
Asked Answered
L

2

9

I have a similar issue in that after loading MiniProfiler and MiniProfiler.EnitiyFramework6 I have this issue. MiniProfiler runs fine, but when I add to my Applcation_Start in Global.asax

MiniProfilerEF6.Initialize();

I get this:

An exception of type 'System.IO.FileLoadException' occurred in MiniProfiler.EntityFramework6.dll but was not handled in user code

Additional information: Could not load file or assembly 'MiniProfiler, Version=3.0.11.0, Culture=neutral, PublicKeyToken=b44f9351044011a3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Longboat answered 19/11, 2014 at 16:57 Comment(0)
L
19

Turns out that this may be related to versions and ids. If you install MiniProfiler.EntityFramework6 without installing the other packages, nuget will handle the dependencies, but it puts the wrong #s in the web.config here (make sure the version number is correct):

 <dependentAssembly>
    <assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.2.0.157" newVersion="3.2.0.157" />
  </dependentAssembly>

If you uninstall all the MiniProfiler packages and then install in this order:

MiniProfiler
MiniProfiler.MVC4
MiniProfiler.EF6

It seems to work ok.

Longboat answered 19/11, 2014 at 21:26 Comment(5)
... or just update MiniProfiler package - it takes care of that redirectVishnu
No, updating the package does not fix the thing. The solution proposed in this answer does.Rhesus
Glad to see that this solution is helping others. I thought maybe just my environment was goofed, but it looks like it's a MiniProfiler issue.Longboat
Updating and reinstalling didn't work for me. Custom replacing the bindingRedirect did work for me. Thanks!Sampan
Updating (not reinstall) MiniProfiler did work for me.Hypostatize
U
0

For others having similar issues This is how I resolved

Please analyze what version of Entity Framework your application is using PM> Get-Package

and then install MiniProfiler.EF accordingly

Like in my case I installed Install-Package MiniProfiler.EF5

Upanchor answered 1/6, 2017 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.