No Entity Framework provider found ... with invariant name 'System.Data.SqlClient'

.net c# entity-framework wcf


None of the posts on here has seemed to address this specific version of my error but I may just be missing something...


MVC website consumes a WCF service. Data is saved in the WCF service. Both are running

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

Both have connection string:

    <add name="SiteTrackerEntities" connectionString="metadata=res://*/VisitorInformation.csdl|res://*/VisitorInformation.ssdl|res://*/VisitorInformation.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=BADLANDS\;initial catalog=SiteTracker;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Site runs until I actually try to save to the database in the WCF service using (errors on second line)...

SiteTrackerEntities db = new SiteTrackerEntities();
db.Entry(visitorData).State = System.Data.Entity.EntityState.Added; 

I then get this lovely error:

VisitorInformation.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See for more information.
  • Made sure that both are using the same version of EF (6.0). Check.
  • Tried to enter the provider name in the connection string but already using providerName="System.Data.EntityClient"
  • Tried removing and reinstalling EF using PM console. Check.
  • Manually removed Ef references and readded them. Check.
  • WCF Service has reference to Entity.Framework.SqlServer (version Check.
  • MVC application has connection string to the database that is only used in the WCF service (odd that it needs it but okay). Check.

What am I missing?

6/12/2014 2:06:22 PM

Accepted Answer

Make sure you have something similar to the following in your Web.config or App.config.

   <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
     <provider invariantName="System.Data.SqlClient"         type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
6/12/2014 2:11:08 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow