title: ASP.NET - Failed to map the path '/myappname'
body: <p>I'm getting this really annoying error when trying to set up a new application in IIS 7.5 on Windows Server 2008 R2.</p>
  
  <p>I'm adding a new application under the default website in IIS 7.5, <em>myappname</em></p>
  
  <p>I have the application pool for the application set to <em>ASP.NET v4.0</em></p>
  
  <p>I've tried copying the files from another application that is working on the same server, different website, and it still fails, so I don't think it has anything to do with the web.config settings.</p>
  
  <p>If I browse to <em>http://localhost/myappname</em> (or browse to any file/path under that application) I get the below error:</p>
  
  <blockquote>
    <h2>Server Error in '/myappname' Application.</h2>
    
    <p>Failed to map the path '/myappname'.  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. </p>
    
    <p>Exception Details: System.InvalidOperationException: Failed to map the
    path '/myappname'.</p>
    
    <p>Source Error: </p>
    
    <p>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.</p>
    
    <p>Stack Trace: </p>
  
  <pre><code>[InvalidOperationException: Failed to map the path '/myappname'.]
  System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +336
  
  [HttpException (0x80004005): Failed to map the path '/myappname'.]
  System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700992
  System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
  System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869221
  </code></pre>
  </blockquote>
  
  <p>I really don't get it. ALSO - if I go to the "Edit Application" dialog, and use the "Test Settings" button, then I get a error:</p>
  
  <p>"There was an error while performing this operation. Details: Invalid application path"</p>
  
  <p>which is BS, because I selected the path using the <code>...</code> button to browse for the path.</p>
  
  <p>Also, that same error occurs when I use the "Test Settings" button on some of the other <strong>working</strong> websites on the server, so I'm not sure what to make of that and whether it's even relevant.</p>