0

I want to implement a WCF service with a proxy. The service and proxy are situated in 2 different projects. The entityFramework is in the Service project. And in the proxy's app.config I put the connection string as below:

<add name="foodOrderEntities" connectionString="metadata=res://*/foodOrderEF.csdl|res://*/foodOrderEF.ssdl|res://*/foodOrderEF.msl;provider=System.Data.SqlClient;
provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\foodOrder.mdf;integrated security=True;connect timeout=30;
MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

the map of the solution

But when I try to invoke the method with the service test client I get the following exception: @"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. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."

Please anyone could tell me how can I set up the connection string in such a way that the proxy project serviceHost can access the database successfully? Or do I need to crate another project independently for the EF object and then add reference?

Pengda Wu
  • 11
  • 1
  • 2

2 Answers2

0

Sorry, guys I found another post that is relevant to this issue. No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

after all, what I need to do is just to add the reference of EntityFramework.SqlServer.dll to the proxy project.

Community
  • 1
  • 1
Pengda Wu
  • 11
  • 1
  • 2
0

Try installing the Nuget Entity Framework download in the service project. I'm pretty sure both the Service project and the ADO.NET Data layer project should have the Entity Framework installed.

Cwinds
  • 167
  • 11