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!

Join the Conversation

No comments

  1. Hi ,

    I have the same Problem. It is solved once you open the VS2008 with admin rights.

    Does it make any problem if i deploy the site as it is on server ?

  2. hie,
    i had the same problem and found a solution without starting vs2010 under admin.
    instead of using the openwebconfiguration method, i use directly the properties avalaible for reading.


  3. Hello Experts,

    I also faced the same error while i am generating workflow in Sybase. Can you please tell me in which i have to change , and above comments, which solutions is right ?

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.