While coding on one of our project in Visual Studio 2010 with SharePoint 2010, I got this error while deploying the project on SharePoint farm.
“Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary”
Now the point is that this message is not very specific about where we exactly got wrong or what key which is not present in the dictionary(web.config).
Best thing about this error is that its solution is very simple and its that you have to make sure that site URL’s host you deploy your solution should be same as SharePoint’s default alternate access mapping.
For example in SharePoint’s Central Administration, Alternate Access Mappings you might have are
|Internal URL||Zone||Public URL for Zone|
If in Visual Studio’s Properties window you have
Site URL = http://localhost/ you get the error mentioned. But it will work with
Site URL = http://machine-name.
Isn’t it was simple 🙂