Could not load web.config file. The given key was not present in the dictionary.

Quick hint about debugging SharePoint projects in Visual Studio 2010. You may find a bizarre error where deploying projects/solutions is fine, but trying to debug doesn’t work. You see an error alert with the text:

“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.”

Checking the Web.config shows no malformed XML at all. One thing to check into is the configuration of alternate access mappings in Central Administration. For debugging to work, the Site URL property of your SharePoint project must match the URL of the Default zone for your web application.

Check: Central Administration > Application Management > Configure alternate access mappings > Edit public URLs


  1. You rocks… some one in my team has changed it and i was trying to debug solun from 2 days. I thought I have upgraded VS 2013 and thats reason it was not working. But its here…

  2. Thanks. I had this problem My site domain name was changed, so I had to change the domain name in the site url property in my project properties too.

Leave a Reply

Your email address will not be published.