IIS 10 fails to parse .cshtml file

1.6k views Asked by At

I am developing an mvc c# episerver website. The site is loaded on IIS 10/Win 10 wih a dedicated application pool etc. After I did some changes in the code and on the specific .cshtml that relates to a layout I receive the following error on all the pages that share that layout.

The following file could not be rendered because its extension ".cshtml" might not be supported: "~/Views/Shared/Layouts/_Root.cshtml".

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.Web.HttpException: The following file could not be rendered because its extension ".cshtml" might not be supported: "~/Views/Shared/Layouts/_Root.cshtml".

Source Error:

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.

All the other pages with different Layouts work fine. Also if I load the website with visual studio iisexpress works fine.

Anyone has any idea why my IIS is freaking out?

2

There are 2 answers

1
Rayno Jacobs On BEST ANSWER

According to this the solution is to clear the asp.net cache files

Delete the files inside the folders:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\

0
dampee On

It might be a compilation error in your view.

For me it was a broken dependency which caused and a broken taghelper