'DbProviderFactories' section can only appear once per config file error RRS feed

  • Question

  • User-718146471 posted

    I've recently solved this problem so I wanted to post the fix not only for my own benefit but for anyone else who encounters the problem. When you install Visual Studio 2010, sometimes but not always, the machine.config files for framework versions 2 & 4 may end up with two DbProviderFactories sections, however the second one will be blank. See below for the solution:

    Check the following files:

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\Machine.Config C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Machine.Config The block to pay attention to is this: <system.data> <DbProviderFactories> <add name="IBM DB2 for i5/OS .NET Provider" invariant="IBM.Data.DB2.iSeries" description=".NET Framework Data Provider for i5/OS" type="IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26"/> <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> </DbProviderFactories> <!-- This is the line to remove - empty element --><DbProviderFactories/> </system.data>
    Thursday, June 23, 2011 7:59 AM

All replies

  • User-658372785 posted

    Thanks a lot for this fast but efficient tip.

    Got the error wihle doing a simple import from Excel to a local db.


    Monday, November 21, 2011 1:53 PM