Unable to find the requested Net Framework Data Provider

1k views Asked by At

Its a very specific error message, but I can't find the problem.

I have a windows service that needs to communicate with a database, for that I do the following:

string provider = "Devart.Data.PostgreSql";
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);

But it crashes, giving me this error:

System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)

I tried to move the Devart.Data.PostgreSql.dll to the bin folder, but the results are the same.

Then I checked my machine.config, and I have this:

<add name="dotConnect for PostgreSQL" 
     invariant="Devart.Data.PostgreSql"
     description="Devart dotConnect for PostgreSQL" 
     type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=7.4.506.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />

So it looks right, I didn't found any empty tags, found that in other SO posts, saying that removing those tags when empty could solve the problem, but I didnt had any.

So I don't know what is the problem.

I also created a console project, which uses the same .Net version, and with the exact code:

string provider = "Devart.Data.PostgreSql";
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);

And it works. Does anyone knows what could it be?

0

There are 0 answers