title: The layout page "{path}" could not be found
body: <p>We just got a new Windows 2008 R2 server and I am trying to set up an MVC 3 site in IIS 7.5 with the Razor View Engine. I am getting a strange error when I access the default route.</p>
  
  <blockquote>
    <p>The layout page
    "~/Views/Shared/_Layout.cshtml" could
    not be found at the following path:
    "~/Views/Shared/_Layout.cshtml".</p>
  </blockquote>
  
  <p>This is strange because I explicitly set the Layout from within <code>/views/home/index.cshtml</code> like so:</p>
  
  <pre><code>@{
    Layout = "~/Views/Shared/_Layout.cshtml";
  }
  </code></pre>
  
  <p>I am 100% certain that the <code>/views/shared/_layout.cshtml</code> exists in the file system. Here's a screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/0kEWJ.png" alt="enter image description here"></p>
  
  <p>If I remove the <code>Layout = "~/Views/Shared/_Layout.cshtml";</code> from my view, the page will render out the contents of <code>/home/index.cshtml</code> all by itself (without any of the code from <code>_Layout.cshtml</code>). I have also tried setting the layout using <code>_ViewStart.cshtml</code>.</p>
  
  <p>Anyone know why MVC wouldn't be able to "find" the layout file? This website works perfectly fine when running in the built-in web server for visual studio. </p>
  
  <p>Here's my stack trace:</p>
  
  <pre><code>[HttpException (0x80004005): The layout page "~/Views/Shared/_Layout.cshtml" could not be found at the following path: "~/Views/Shared/_Layout.cshtml".]
     System.Web.WebPages.WebPageExecutingBase.NormalizeLayoutPagePath(String layoutPage) +204956
     System.Web.WebPages.WebPageBase.PopContext() +150
     System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384
     System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +33
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
     System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976
     System.Web.Mvc.Controller.ExecuteCore() +159
     System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
     System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +62
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +20
     System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +54
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +371
  </code></pre>