I've been working on this web application for a couple of weeks now. <-- Key information! And everything has been working fine; data goes into the database, etc.
It's an ASP.Net 4.0 / C# Web Form.
Today, I added a new Web Form page and added a GridView to it. It worked fine.
I was editing the columns of the GridView, making some wider for long strings like addresses. It all worked fine. Fine.
I wanted to make the "Comments" field wider and multi-line so it displayed nice in the GridView, so I converted it to a "Template Field" and set the Item Control width. When I refreshed the page I got this error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Source File: E:\inetpub\StartupNow\web.config Line: 9
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491
-- I get that error on both pages. Even the one I was not working on and worked fine.
The Application Pool for the web site was set to Framework 2.xxx. When I added a Template Field to the GridView, that must have required Framework 4.xxx which is the framework I'm developing the site in. When I set the Application Pool in IIS 7.0 to Framework 4.0 that resolved the problem.