I am totally lost. In Visual Studio 2015, I created a WCF Library Service project and defined the service and service interface.
EntityFramework, EntityFramework.SqlServer, EntityFramework6.Npgsql, and Npgsql was installed with the NuGet console:
Setting the library service as startup then starting debug (f5) correctly read the available procedures. However, upon testing any procedure in the WcfSvcHost, I get the following error:
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
What did I do wrong?
Here is the App.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<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" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="NovaMedicalService.MedicalService">
<endpoint address="" binding="basicHttpBinding" contract="NovaMedicalService.IMedicalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/NovaMedicalService/MedicalService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" />
</providers>
</entityFramework>
<connectionStrings>
<add name="chaosEntities" connectionString="metadata=res://*/ChaosModel.csdl|res://*/ChaosModel.ssdl|res://*/ChaosModel.msl;provider=Npgsql;provider connection string="Database=chaos;Host=localhost;Password=yuyuyu;Username=ooosos"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Can someone please help? I am totally lost.
TIA
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details. · Issue #1439 · npgsql/npgsql · GitHub Have a question about this project?
Latest version of Npgsql is 3.2.5, while latest version of EntityFramework5.Npgsql is only 3.1.1. Sorry, something went wrong. @ajelesin no, the Npgsql and EntityFramework5.Npgsql versions aren't synchronized.
To use the Npgsql EF Core provider, add a dependency on Npgsql.EntityFrameworkCore.PostgreSQL. You can follow the instructions in the general EF Core Getting Started docs. Below is a .csproj file for a console application that uses the Npgsql EF Core provider:
Development happens in the Npgsql.EntityFrameworkCore.PostgreSQL repository, all issues should be reported there. To use the Npgsql EF Core provider, add a dependency on Npgsql.EntityFrameworkCore.PostgreSQL.
Problem solved. I neglected to add:
<system.data>
<DbProviderFactories>
<remove invariant="Npgsql" />
<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF" />
</DbProviderFactories>
</system.data>
(See Visual Studio Support (DDEX)
uninstalling and reinstalling Npgsql.vsix resolved this problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With