Question

I am using entity framework with mvc-mini-profiler. After upgrading from mvc-mini-profiler 1.7 to version 1.9 and solving some issues, I managed to compile my project. Now I am getting the following runtime exception:

Unable to determine the provider name for connection of type 'MvcMiniProfiler.Data.EFProfiledDbConnection'

I think the problem might be related with the configured db provider factories, because I had the same issue with version 1.7 and solved it by adding the following to my .config file:

<DbProviderFactories>
    <remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
    <add name="MvcMiniProfiler.Data.ProfiledDbProvider" 
         invariant="MvcMiniProfiler.Data.ProfiledDbProvider" 
         description="MvcMiniProfiler.Data.ProfiledDbProvider" 
         type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.7.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
</DbProviderFactories>

Now I tried to replace the above with the following, but I still get the error:

<DbProviderFactories>
    <remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
    <add name="MvcMiniProfiler.Data.ProfiledDbProvider" 
         invariant="MvcMiniProfiler.Data.ProfiledDbProvider" 
         description="MvcMiniProfiler.Data.ProfiledDbProvider" 
         type="MvcMiniProfiler.Data.EFProfiledDbProviderFactory`1, MvcMiniProfiler.EntityFramework, Version=1.9.1.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
</DbProviderFactories>

What is the correct configuration to solve this issue?

Was it helpful?

Solution

Have you tried removing the DbProviderFactories from your .config?

Do you have the initialize in there?

protected void Application_Start()
{
    ....other code

    MiniProfilerEF.Initialize();
}

With 1.9, I just added the Initialize in Start and removed the config section and now I have SQL profiling with EF.

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