Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to map the path '/'. .net 4.0

Tags:

I have a .net app that I just opened on in visual studio 2010 and converted to 4.0 when it asked me on start-up. I go to try to build the site, and I get this error:

Failed to map the path '/'.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

[InvalidOperationException: Failed to map the path '/'.]
   System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +8804446
   System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) +42
   System.Web.VirtualPath.MapPathInternal() +4
   System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) +107
   System.Web.HttpRequest.MapPath(VirtualPath virtualPath) +37
   System.Web.HttpServerUtility.MapPath(String path) +99
   NU.WorkManagement.Lookup.Lookups..ctor() +82
   NU.WorkManagement.Engine.GlobalModule.Init(HttpApplication application) +624
   System.Web.HttpApplication.InitModulesCommon() +80
   System.Web.HttpApplication.InitModules() +43
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327

I tried the most popular solution I found vis google (replace and ../ with ~/ but there wern't any...)

Update:

Lookups constructor:

public Lookups()
{           
    _dirPath = System.Web.HttpContext.Current.Server.MapPath("/") + _xmlPath;           
}
like image 250
kralco626 Avatar asked Apr 01 '11 12:04

kralco626


1 Answers

I know it's and old question, but for the record if you are running against IIS then

'iisreset' in the console may help resolving "Failed to map the path '/'." issue. I had this problem after renaming the sites in IIS.

like image 160
tymtam Avatar answered Oct 27 '22 05:10

tymtam