Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to save data into the MS SQL db using Entity Framework in dot net core. 
But I am getting this error - "The ADO.NET provider with invariant name 'System.Data.SqlClient' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.' 
"


What I have tried:

I googled the error but couldn't find the solution.
The project is in dot net core.

I installed Entity Framework Core in both the entity project as well as my web project.

Also, added the following code in my web project's app.config file:

C#
<pre>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>
  <connectionStrings>
    <add name="SampleTaskEntities" connectionString="metadata=res://*/SampleTask.csdl|res://*/SampleTask.ssdl|res://*/SampleTask.msl;provider=System.Data.SqlClient;provider connection string="data source=SUYASH3148523;initial catalog=SampleTask;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
Posted
Updated 28-Oct-22 23:11pm
v2
Comments
F-ES Sitecore 4-Jan-19 6:53am    
If you googled and didn't find the solution you must have tried a lot of solutions. List what you've tried that didn't solve the issue so people don't waste their time suggesting things you've already looked at.
#realJSOP 4-Jan-19 7:08am    
Did you inspect the inner exception?
Member 14108019 4-Jan-19 7:44am    
Inner Exception is "ArgumentException: The specified invariant name 'System.Data.SqlClient' wasn't found in the list of registered .NET Data Providers.
"

1 solution

I gogled it and got over 10,000 results:

The ADO.NET provider with invariant name 'System.Data.SqlClient' is either not registered in the machine or application config file, or could not be loaded. - Google Search[^]


There appear to be several causes, and ONLY YOU can decided what the appropriate fix is.
 
Share this answer
 
Comments
Member 14108019 4-Jan-19 7:46am    
I know and I have tried many of them but none of them worked. Can you tell me if we have to mention anything regarding entity framework in startup.cs in .net core in order to use it.
Member 9615886 25-Dec-19 11:47am    
Core2.1 dose not support DbProviderFactories. I donot know why not use it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900