Error: Unable to load configuration file: Failed to map path '/'

Hello Experts,

My application was running fine till yesterday. I dont know what changes did i do. I am getting failed to map path '/' in some pages . I tried to google it , some of them say that you need to run Visual Studio as administrator which I am doing but the error is still there.

This is the code where it is generating error. I am trying to set password in my web.config file.

protected void Page_Load(object sender, EventArgs e)

{

config =
WebConfigurationManager.OpenWebConfiguration("~");

section = (AppSettingsSection)config.GetSection("appsettings");

System.Configuration.KeyValueConfigurationElement c = config.AppSettings.Settings["Password"];if (null != c)

{

TextBox2.Text = c.Value;

}

Regards,

Pradeep 

 

 

 

-1
pradeepkk2008
11/3/2008 3:06:35 PM
asp.net.config-deploy 12495 articles. 0 followers. Follow

3 Replies
3950 Views

Similar Articles

[PageSpeed] 27

Hi,

If your configuration file is in the root of your website, you can try to use "/YourWebSiteName" to replace "~". For example: WebConfigurationManager.OpenWebConfiguration("/YourWebSite");

Is your website IIS-Based or File System-Based? This configuration file should be in virtual path.

 

I look forward to hearing from you.


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
11/6/2008 9:28:38 AM

Hello Thomas,

I have tried the virtual path of my application which is /Corridor , but it gives me same error.

My web.config resides in C:/Project/CT6/Corridor/web.config. and my project location is C:/Project/CT6/Corridor

This is strange as same code was running before.now its giving error.

I guess this application is IIS based rather than file based. How do you check whether the application is IIS based or file based?

Looking forward to get this sorted as I have a demo to give

Thanks

Pradeep

0
pradeepkk2008
11/6/2008 11:24:00 AM

Hi,

Thanks for your response.

If website is File System-Based, it is using ASp.NET built-in server as Development server, instead of IIS. Its url should like http://localhost:portNo/websiteName/PageName.aspx.

You can try to put your website to "C:\Inetpub\wwwroot" (which is virtual directory by default), and then open it use Visual Studio by File->Open->Web Site->Click "Local IIS" from left, and then select your website.

 

I look forward to hearing from you.


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
11/7/2008 8:28:43 AM
Reply:

Similar Artilces:

An error occurred loading a configuration file: Failed to map the path '/'.
Hi everyone, An error occurred loading a configuration file: Failed to map the path '/'.   I m getting this error when i try to click on "Security" Tab after running "ASP.NET Configuration".I have already created database using "aspnet_regsql.exe" tool and chosen Membership and Role Provider and tested successfully.Can anyone help me to find out what is problem?-bikki   Hi bikki, I am not sure what the real reason was. As a solution, I suggest you try to remove the web.config file and try use "ASP.NET configuration&quo...

Problem - Published site
I'm in dire need of help - IIS6. I use vs2005 SP1 and it runs fine. when I deployed to live environment I got this(screenshot below). Other dependencies .net2.0, Ajax and ajaxcontroltoolkit. It was working fine. I worked on it, and then thought I was doing a simple publish, and life would be good. Nope I have an error. I can't find the problem - PLEASE HELP! Dev environment. XP with VS2005 .net2, c#, sqlserver2005     Your error graphic never made it through, but it doesn't matter.  The problem is your path has a .com in it, which causes all sorts of iss...

Give access to non virtual folder through configuration entry? ERROR: <location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'.
I have a webpage running under a virtual directory that is mapped to d:/webapplication that produces an excel spreadsheet, the page calls a library object that generates a report and places it in a folder d:/attachments. This folder is not in the virtual directory. When I access the webpage i click a button and it attemps to return the created spreadsheet as a mim content type application/vnd.ms-excel. However i getting redirected back to the login page of the application. Ive also noticed that the excel spreadsheet has not even been created at this location. So assuming this...

Unable to create web project 'WebApplication1'. The file path 'c:\inetpub\wwwroot\WebApplication1' does not correspond to the URL 'http://localhost/WebApplication1'. The two need to map to the same se
Hi, I am using a Windows 2003 server machine with VS2003 , SQl Server2000 and sharepoint portal installed. When i try to create a new ASP.NET application I am getting this error : The default Web access mode for this project is set to file share, but the project folder at 'http://localhost/WebApplication1' cannot be opened with the path 'c:\inetpub\wwwroot\WebApplication1'. The error returned was: Unable to create web project 'WebApplication1'. The file path 'c:\inetpub\wwwroot\WebApplication1' does not correspond to the URL 'http://localhost/WebApplication1'. The two need to map to the...

SOLVED: Trying to read web.config connectionStrings using OpenWebConfiguration but getting error Failed to map the path '/'.
Dear all, I have been trying for 2 days to read the connection string for my MySQL database from the web.config file so I can update a table with code in a page_load sub, but I can't get it to work at all. I even copied the code from the MSDN How to page (http://msdn.microsoft.com/en-us/library/ms178411(VS.80).aspx), which makes it seem all so simple! I have searched every forum on the planet, but cannot find the answer to this one - nearly, but not quite.. Any assistance greatfully received. Cheers Ross Holland ps. Using ExpressionWeb<script runat="server"> ...

Failed to map the path '/' error
Hi all, I'm using Visual Studio 05 ReportViewer. The reportviewer needs to show a chart. There is a strongly typed dataset that has been binded to the reportviewer. The project compiles successfully, but when run, gives the error "Failed to map the path '/' error".  Processing mode is set to Local. How do I solve this problem?. Thanks in advance. Peeyush Agrawal...

Failed to map the path '/Config'.
I have a virtual directory called "/Config". The following code is now giving an error (used to work in VS2003 and Dot-net 1.1): Dim strConfigFile As String = objContext.Server.MapPath("\Config") & "\DNConfig.ini" HELP?Owen Hmmm. This is because VS2005 does not run its debug session in a particular web site installed on the computer (see also my other post: http://forums.asp.net/1234452/ShowPost.aspx), it runs the debug session in its own special web server.  SO, any virtual directories configured in the IIS web site are not seen. To get around this, I had to tell VS2005 to ope...

An error occurred loading a configuration file: Failed to start monitoring changes to 'C:\Inetpub\wwwroot\VSS\Web\app_code' because access is denied.
All of a sudden in VS 2005, I'm starting to get this when performing a build on our website that I wasn't getting before.  The website is copied  down locally on my C:\.  It's always been fine.An error occurred loading a configuration file: Failed to start monitoring changes to 'C:\Inetpub\wwwroot\VSS\Web\app_code' because access is denied.One of my bosses, probably caused the issue.  He had added some keys to my registry just like he did for everyone else on the team.  AS far as I know they don't get this error but I do.   HE put this in the web.config for our ...

Weird Error: Failed to map the path '/'
 I have a Master Page with this code in it: <script language="javascript" type="text/javascript" src='<%= ResolveClientUrl("~/js/global.js") %>'></script>     It's my default Master page across my web site.I am running my web site using built-in VS2005 web server.  I have a NewUser.aspx page who using this master page. in this page I get this error: System.InvalidOperationException: Failed to map the path '/'.MasterPage.master    Line: 19  Stack Trace: ...

ERROR [Error] unable to read PCH file: 'No such file or directory'
[Error] unable to read PCH file: 'No such file or directory' Why this problem occurs in XE7, but not in XE6 > {quote:title=ww6 wuxu wrote:}{quote} > [Error] unable to read PCH file: 'No such file or directory' > Why this problem occurs in XE7, but not in XE6 I can see this error in the XE6 also. -- With best regards Vladimir ...

Published site -Configuration Error Message: Access to the path 'C:\Websites\abc.com\Config\mysettings.config' is denied.
HiI've a problem when i try to upload my project to ftp.The following error occured. I can't find the problem - please help!Server Error in '/' Application. Access to the path 'C:\Websites\abc.com\Config\mysettings.config' is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access to the path...

Server Error in '/Webapp' Application. Could not load file or assembly 'System.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.
 10 minutes ago, my web app worked fine.  Now it appears broken and I hadn't touched the web.config file.  Anyone know what might be going on here?  I checked my web server's .NET folder (C:\WINDOWS\microsoft.net\Framework64\v2.0.50727) and there is indeed a system.data.dll file...  Could not load file or assembly 'System.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception occurred during the execution of the current web request. Plea...

Unable to convert AJAX site in VS 2008, I get 'Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025 error..'
This is the full message, i get one fore each ajax control on my site.  Error 1 Unable to create type 'cc1:TabContainer'. Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. V:\ASP\RemoteFitness3\Members\MembersHome.aspx 75  My web config is pointed to 3.5<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>   And i have...

Unable to open Web project 'GEC'. The file path 'C:\Inetpub\wwwroot\GEC\test' does not correspond to the URL 'http://Localhost:/GEC'.
I'm a VS 2005 guy so I need some reasoning here as to why I can't get this .NET 1.1 web project to open in VS 2003.After clicking the web project from C:\inetpub\wwwroot\GEC\GEC.vbproj, I get the following error in VS 2005: Unable to open Web project 'GEC'. The file path 'C:\Inetpub\wwwroot\GEC\test' does not correspond to the URL 'http://Localhost:/GEC'. The two need to map to the same server location. HTTP Error 404: Object Not FoundWhen is Microsoft going to get rid of VB.NET! Hi dba123,This may be a little late now, I figure 5 days have past, but ju...