There is a WCF service that is hosted on a console application.

Now I want to transfer it to the WinService.

I made it a library and added it to the WinService project.

When requesting a WCF service, an error occurs:

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

What am I doing wrong? I copied the console application configuration into the app.config WinService ...

    1 answer 1

    If memory fails me, then you just need to install the EntityFramework in the service. For it does not integrate into DLL. Your service starts, reads App.config and is in a state of shock, because it does not understand these configuration parameters without the separately installed Entity Framework package.

    UPDATE

    In your config there is not enough section with the configuration of the Entity Framework itself. I’m not going to tell you exactly how it should look, but in one of my projects the section looks like this:

    <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> 
    • Now this crashes: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception. - iluxa1810 9:39 pm
    • Add the Entity Framework'a configuration in App.config. I am almost sure that it is not in the service ... For a common understanding: after you have created the library and tied it to another project, the config and project packages to which the library is attached will be used. - Walter Nuss
    • I added my config to the question. So now I have everything looks ... - iluxa1810
    • Well, I lost the answer. - Walter Nuss
    • It was in the version. NuGet registered the old version in the config, I changed it to 6.0 and it all worked. - iluxa1810