Sometimes a user encounter problems starting Design Tool with some strange exception message stating "The 'DbProviderFactories' section can only appear once per config file.". This comes from the fact that IBM DB2 installs a faulty configuration into some system data which means that Windows/.NET cannot add other database configurations to it without breaking the configuration file.
Symptoms:
User cannot start Design Tool and the below exception is displayed.
Guide to fix:
Apparently this is a known issue with the IBM DB2 software that installs its own database driver. This unfortunately corrupts two of the machine.config files so they can no longer be appended. In order to solve this, you need to open the corrupted files and remove a line. Apparently this is fixed by installing an update of the IBM DB2 software, but I have not found any such right now.
To be able to fix this manually, you need to have administrator access on your machine, otherwise you will have one of your administrators to correct this on your machine.
When you have administrator access, follow the below guide to correct this:
- Open each file below in Notepad or similar text editing tool (make sure it can write to the file)
- C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
- C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
- C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
- In each file search for the text “<DbProviderFactories/>” (should be around line 156)
- If you cannot find it, the file is fine and continue with the next file
- If you find it, remove the text and save the file
More information can be found here:
- http://stackoverflow.com/a/27155292/28553
- http://forums.asp.net/t/1693277.aspx?+DbProviderFactories+section+can+only+appear+once+per+config+file+error
- http://www-912.ibm.com/systems/electronic/support/a_dir/as4ptf.nsf/ALLPTFS/SI41054 (Search for “APAR SE45767”)
Exception:
ERROR VisualComponents.UX.Shell.AppBootstrapper [(null)] - UnhandleException (OnUnhandledException) (GetLastError = 0) System.Configuration.ConfigurationErrorsException: The 'DbProviderFactories' section can only appear once per config file.
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Data.Common.DbProviderFactories.Initialize()
at System.Data.Common.DbProviderFactories.GetProviderTable()
at System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(String nameOrConnectionString)
at VisualComponents.eCatalogue.DataModel.Data.eCatalogueStoreDataContext..ctor()