This error sometimes is caused by another error: “The ‘DbProviderFactories’ section can only appear once per config file.” This is caused occasionally by migrating from .Net 2.0 to 4.0 or by installing IBM DB2 on server machine. These actions can cause having two entries for ‘DbProviderFactories’ in the Machine.config file. When the application is trying to access database using entities it requires having only one entry for this tag, therefore, it causes the error. The machine.config file is located at
- Windows xp – C:\WINNT\Microsoft.NET\Framework\v4.0.30319\Config
- Windows 7 – C:\windows\Microsoft.NET\Framework\v4.0.30319\Config
The corrupted Machine.config file looks as following (with 2 ‘DbProviderFactories’ entries):
As it can be seeing there are to tags for ‘DbProviderFactories’:
To resolve this issue, the empty tag needs to be removed and this should solve the problem:
Thank you very much for this tip. Bang on solution. Saved my day. IBM DB2 was installed on my machine, and I guess that it corrupted the machine.config
Solution worked like a charm.
Glad that it worked out 🙂
very helpful.