Archive for November, 2009

Failed to map path ‘/’

20 November 2009 Leave a comment

Have you ever seen this problem? It looks a bit like this…

Well you might if you are working on Vista, Windows 7 or Windows 2008. In this case I’m on Windows 2008. The simple workaround is to run Visual Studio as an administrator, but this is bad and what if it occurs in production and not just during development?

Well the guys at Microsoft have the answer…

Calling OpenWebConfiguration(null) means that code wants to open the root web.config file for *both* read and write access. The default file-system ACLs on the root web.config file only grants write access to administrators. The "Users" group has read access. The root web.config file is locked down to only grant write access to administrators because configuration changes to this file affect every web application on a machine.

Applications that intend to only edit configuration information for a specific application should call one of the OpenWebConfiguration overloads that accept a specific path and a web site name. This will cause the configuration system to request write access for an application-specific web.config file, as opposed to the global root web.config file. – Microsoft Connect (

There you go, the cause of the problem is how the web.config is being opened. In most cases you only want to open it for READING, not for writing… so how can you do that?

Forget the WebConfigurationManager.OpenWebConfiguration() methods. Use the WebConfiguration.GetSection() method instead. This will get the configuration from the currently executing ASP.NET application.




Categories: Uncategorized