The 'DbProviderFactories' section can only appear once per config file

Chad picture Chad · Dec 11, 2012 · Viewed 9.9k times · Source

We are receiving this error when calling a WCF .net 4.0 service using entity framework.

The 'DbProviderFactories' section can only appear once per config file

It is the first app on the server using EF and other .net 4.0 WCF services are not receiving this error.

Is there any way to correct this error with out editing the machine config file on the server?

Answer

yonsk picture yonsk · Feb 7, 2014

The installation for IBM DB2 .NET provider, causes an empty DbProviderFactories, see below. Just delete the second empty entry DbProviderFactories

<system.data>
    <DbProviderFactories>
        <add name="IBM DB2 for i .NET Provider" invariant="IBM.Data.DB2.iSeries" description=".NET Framework Data Provider for IBM i" type="IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26" />
    </DbProviderFactories>
    <DbProviderFactories />
</system.data>