I have a simple ASP.NET website which used to work fine on my Windows 8 machine. However, recently, if I go to the website directly hosted on the IIS, I get a Parse Error on the first line of the master page.
Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Operation could destabilize the runtime. Source Error: Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="SampleGallery.master.cs" Inherits="SampleGallery" %> Line 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Line 3: Source File: /SampleGallery.master Line: 1
Now, when I open the site in VS2012 and run it, I do not get any errors and the site runs as expected.
This has happened to other sites on my IIS as well, so I am thinking it is some settings/problem on the IIS related to .NET 4.0 (which is the framework for the App Pools that I have configured), but after searching through the net for a few weeks, I am not able to find out what it is.
I have tried to reinstall .NET 4.5 using "Turn Windows Features On and Off" and also reinstalling ASP.NET using the aspnet_regiis.exe. Also tried reinstalling IIS along with .NET 4.5.
PEVerify on the dependent DLLs in the Bin directory also did not yield any errors.