Monday, January 28, 2013

How to fix asp.net configuration Error

I try to upgrade my previous project from .Net Framework 2.0, 3.0 and 3.5 to the latest
.Net Framework 4.5.

Server Error in '/MyOldApp' Application.

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: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:

Line 14:   -->
Line 15:   <system.web>
Line 16:     <compilation targetFramework="4.5"/>
Line 17:     <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
Line 18:       <controls>

Source File: C:\Development\Intranet\MyApp\web.config Line: 16


Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618 


the root cause of this issue is that all my application had been configured  to run windows authentication and run under the application pool that configure with service account.

when i set up the application pool, it was configured to run in the asp.net 2.0 environment. 
as a result, i will get the above error when i deployed my upgrade code to staging environment.

after i create a new applicaiton pool running in .net framework 4.0. the configure error is fixed.

Friday, January 25, 2013

How to fix "Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Today i got a very weired error as following
"Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."


when i check my project properties, under the application tab. the target framework had been
set to .Net Framework 3.5














the root cause of this issue is that new library
using System.Net.Http; 
using System.Web.Script.Serialization;  
that Newtonsoft.Json depends on are  Available at the .Net Framework 4.0 or 4.5.
after i switched to the latest .Net Framework.the project compile and the page was launched.