开发者

"Unable to determine the provider name" error with mvc-mini-profiler 1.9

开发者 https://www.devze.com 2023-04-01 20:54 出处:网络
I am using entity framework with mvc-mini-profiler. After upgrading from mvc-mini-profiler 1.开发者_JAVA技巧7 to version 1.9 and solving some issues, I managed to compile my project. Now I am getting

I am using entity framework with mvc-mini-profiler. After upgrading from mvc-mini-profiler 1.开发者_JAVA技巧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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消