Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have built one website using the .net framework 4.5 . Here is the code snippet from the Web.config file.
XML
<compilation debug="true" targetFramework="4.5"/>

I have hosted the same website in my local machine IIS7. While creating a new website, Application pool I selected as 4.0. When I try to access the same from the browser I am getting below error.

C#
Server Error in '/' 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:     <httpRuntime/>
Line 18:     <pages controlRenderingCompatibilityVersion="4.0">

Source File: C:\inetpub\wwwroot\polygontechnologies.com\web.config    Line: 16 

Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491


So, as of now I have targetFramework="4.5" in web.config and in IIS application pool it is 4.0.

Anybody help me in fixing the issue.
Posted

1 solution

Although you have clearly mentioned that you have selected
.NET Framework Version = v4.0.XXXXX in application pool, but your error says you still have .NET Framework Version = v2.0.XXXXX selected.

Go to the IIS again and check.

IIS  -- Right Click on your hosted website -- Advanced Settings -- Application Pool -- Select version 4.0


If this doesn't work then make sure that you have installed .Net framework 4.5 in your system.
How to find the .NET version?[^]

Hope, it helps :)
 
Share this answer
 
Comments
PrashanthJagannath 21-Nov-15 4:03am    
Thanks for your reply. I am using VS 2015 for development. Yes, as I mentioned earlier, Application pool selected as Framework 4.0 only and .Net framework 4.5 & 4.6 are installed in my machine. Can you please let me know what may be the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900