How to solve DbProviderFactories section can only appear once per config file error

H

Once upon a time, there was a program called ‘Agresso’. It uses the .NET framework.

When I started the program and wanted to log in. I got the following error message: DbProviderFactories section can only appear once per config file error. -.-‘

After some research, I discovered it was a bug in the .NET framework. (not surprising me :p). Now, to solve this, do the following steps below.

First, go to C:\Windows\Microsoft.NET\Framework. There you can see different versions. First go to the folder v4.0.30319 and open the Machine.Config file in a text editor. In that file, search for the string “<DbProviderFactories/>”. If you found that you can see the following code:

<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=12.0.0.0, 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=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
    </DbProviderFactories>
    <DbProviderFactories/>
</system.data>

The <DbProviderFactories/> doesn’t belong there so delete this line:

<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=12.0.0.0, 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=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
    </DbProviderFactories>
    <DbProviderFactories/> //you need to delete this line!;
</system.data>

Save it and look in the other folders if the line is there too. It’s possible that this line also appears in v2.0.50727.

When I did this, the program worked like a charm. Enjoy!

9 comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • I’m new to VS and to SSDTBI and this solution worked in my environment… Thanks!
    JC

  • Don’t forget to make the same for the Framework64 directory too ! It works well, thanks ! DS

  • Thank you so much. This fixed my problem. I was unable to install Google Drive for Microsoft Office and this was the only article I found that was related to the error I was getting.

  • When i open the machine.config file it just gives me a blank grey screen?
    had it opened once but didnt have admin rights to delete the line. closed out to get admin rights now blank.

    Any suggestions?

  • this is not a bug in the .NET framework as you suggest. It’s the IBM data provider installation which messes up the machine.config.

  • Thanks, worked for me.
    I changed it in both Framework and Framework64. I wonder how it was added there in the first place

Tag Cloud

Categories