VS 2010: An error occurred loading a configuration file: Failed to map the path ‘/’.

I was using the System.Web.Configuration. WebConfiguration class to open the configuration for the site from one of my logic dll’s and I got the wonderful error An error occurred loading a configuration file: Failed to map the path ‘/’.
I freaked out for a second, until I put more thought into it. This is running fine in production! What is the difference with my machine and the server?
Oh! My Visual Studio is running under UAC with limited privileges since I am in Windows 7. DUH!
So, I restarted Visual Studio 2010 under “Run as Administrator” and problem solved. So if you are on Vista or Windows 7, that’s the issue.
NOTE: If you develop with administrative rights, be careful you don’t make development mistakes that assume everyone will run your program as an admin. i.e. writing to program files directory, root directory, etc.
Happy Coding!


Read More: