ADO.NET provider with invariant name 'System.Data.SqlClient;' cannot be found (Entity Framework MVC)

前端 未结 3 1592
陌清茗
陌清茗 2021-01-20 01:21

I cannot seem to resolve what appears to be a common issue with Entity Framework 6. I have reviewed the many topics related to this issue on SO, and am unable to find a solu

相关标签:
3条回答
  • 2021-01-20 01:55

    For me, this issue is caused by damaged EntityFramework. Uninstall EntityFramework as well as Visual Studio and Re-Installing the Visual Studio - The visual studio installation covers the .Net Framework SDK installation kind of resolved this issue.

    0 讨论(0)
  • 2021-01-20 01:56

    You have this:

    <add name="ReadContext" 
         connectionString="Server=Sql2014intsnace;Database=database;User Id=secret; Password=secret;" 
         providerName="System.Data.SqlClient;" /> <-- semi-colon
    

    It should be this:

    <add name="ReadContext" 
         connectionString="Server=Sql2014intsnace;Database=database;User Id=secret; Password=secret;" 
         providerName="System.Data.SqlClient" /> <-- no semi-colon
    

    Otherwise, you're telling ADO to find a provider named System.Data.SqlClient; - there isn't one.

    0 讨论(0)
  • 2021-01-20 01:59

    I got this error but for me, it was something entirely different. I was able to solve it by looking at only Unable to find the requested .Net Framework Data Provider and finding this answer.

    I then had to edit:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
    

    And:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
    

    Searching for DbProviderFactories both configs looked like this:

    <system.data>
        <DbProviderFactories>
            <add name="IBM DB2 for i .NET Provider" invariant="IBM.Data.DB2.iSeries" description=".NET Framework Data Provider for IBM i" type="IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26" />
        </DbProviderFactories>
        <DbProviderFactories />
    </system.data>
    

    When I removed the trailing <DbProviderFactories /> everything started working again.

    0 讨论(0)
提交回复
热议问题