0

Trying to configure the web.config for my ASP.Net application with EF6 (.Net Framework version 4.6). I am receiving the following error. Thank you for your assistance.

ERROR:

System.InvalidOperationException: 'The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.

Web.Config file:

<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  
  <system.web>
    <compilation debug="true" targetFramework="4.7.2">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.7.2"/>
    <sessionState mode="InProc" cookieless="false" timeout="20"/>
    <authentication mode="Forms">
      <forms cookieless="UseCookies"></forms>
    </authentication>
    <customErrors mode="Off"/>       
  </system.web>
  <system.net>
    <mailSettings>
      <smtp from="support@wisconsinpollinators.com">
        <network host="relay-hosting.secureserver.net"/>
      </smtp>
    </mailSettings>
  </system.net>
  <connectionStrings>
    <add name="POLLINATORSEntities"
         connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
            provider=System.Data.SqlClient;
            provider connection string=&quot;
            data source=SFP;
            initial catalog=POLLINATORS;
            integrated security=True;
            MultipleActiveResultSets=True;
            App=EntityFramework&quot;"
         providerName="System.Data.EntityClient"/>
  </connectionStrings>  
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>

</configuration>
  • Check this : https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded – Arsalan Valoojerdi Aug 28 '20 at 13:49
  • I installed the NuGet package and I'm receiving lots of errors in my data layer project. Type or namespace of DbContext, DbModelBuilder, and DbSet. The Data layer library DLL can not be found ...... and more. – Susan Farrar Aug 28 '20 at 14:11

1 Answers1

0

I decided to roll back to EF5 and everything is now working fine.

Thanks so much for your help Arsalan.