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

放肆的年华 提交于 2019-12-30 10:13:28

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7286481/unable-to-determine-the-provider-name-error-with-mvc-mini-profiler-1-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!