Search code examples
c#asp.net-mvcrazoriis-10

Razor page will not render is IIS10


ASP.NET application works fine in Visual Studio but after publishing to Windows server 2012/IIS10 I receive the following error attempting to run the app via IE The file "/Views/Shared/_Header.cshtml" could not be rendered, because it does not exist or is not a valid page.]

Is this a code issue or IIS configuration problem or ??

Here's the _Header.cshtml...

<div id="header" class="page-header">
    <img src="~/Images/CCIT.png" />
    <font class="page-header">Cow Creek Band of the Umpqua Tribe of Indians</font>
</div>

Solution

  • Change your reference to _header.cshtml from /Views/Shared/_Header.cshtml to ~/Views/Shared/_Header.cshtml.