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:
1 2 3 4 5 6 7 |
<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:
1 2 3 4 5 6 7 |
<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 for “How to solve DbProviderFactories section can only appear once per config file error”