Solving “The given key was not present in the dictionary” error of visual studio 2010

While developing mvc3 razor application I came across one strange error “The given key was not present in the dictionary”.

After searching in google for hours I found the solution for this error.

Actually this error means that “This typically means that you’ve installed a custom data provider, created a Server Explorer connection using that provider, and then uninstalled the provider without deleting the Server Explorer entry”
To solve this error 1st thing you have to do is close all visual studio instances.

Now go to your user AppData directory (e.g. C:\Users\Administrator\AppData)
(Notice: AppData may not be shown in windows explorer if you have “Show hidden files and folders” turned off)

In AppData go to Roaming > Microsoft > Visual Studio > 10.0 > ServerExplorer

There you will find file named DefaultView.SEView. This files stores all connections.

This is a plain XML file, so in theory, you can locate the dud connection by its Label and just remove the containing DataViewNode XML element. In practice, I didn’t have much luck with this – the file stores blobs against connections by index, so deleting individual items can throw those indexes off. But if you’ve got a lot of connections defined and you don’t want to have to recreate them, it’s probably worth giving this a try in case you get luckier than I did.
Otherwise, just delete the DefaultView.SEView file.

Now restart visual studio & its done . Now you are free from that bad error.



  • odai alsgier

    Thank You Very Much