When attempting to manually test a .NET MVC application, I got the following exception from Visual Studio:
Looking at the inner exception revealed this message:
An item with the same key has already been added.
The sitemap file for our application is pretty long (over 1300 lines of XML), but a co-worker pointed me to the potential culprit right away. There was a sitemap node near the end of the file that had empty strings for its controller and action attributes. As far as I can tell, this generates the default url for the site’s home page. Since it already exists, this results in the exception that’s thrown. Removing the sitemap node resolved our issue. A couple of threads that I checked on stackoverflow (here and here) provide other possible causes for the error.