I develop a web api project with ASP.NET. I want to establish a connection between ADO.NET and the databases I have added, but I keep encountering 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.
I searched the internet for a solution but couldn't find it. The solutions in this thread didn't work: Entity Framework ADO.NET Sql.Data.Client provider not found.
What should I do?
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<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="MyModel1Entities" connectionString="metadata=res://*/Models.MyModel1.csdl|res://*/Models.MyModel1.ssdl|res://*/Models.MyModel1.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=MyModel1;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="MyModel2Entities" connectionString="metadata=res://*/Models.MyModel2.csdl|res://*/Models.MyModel2.ssdl|res://*/Models.MyModel2.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=MyModel2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>