12

I made a web site using VS 2012 and MVC4, it is work my localhost but when i published and put my host it doesn't work. IIS confiurations are same. But it gives me this error lines:

This is 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: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.

Source Error: 


Line 20:   </appSettings>
Line 21:   <system.web>
Line 22:     <compilation targetFramework="4.5" />
Line 23:     <httpRuntime targetFramework="4.5" />
Line 24:     <authentication mode="Forms">

Thank you for your advice in advance

nermik
  • 1,485
  • 4
  • 16
  • 24

7 Answers7

12

Change this tag to 4.0:

<compilation targetFramework="4.0" />

and remove this tag:

<httpRuntime targetFramework="4.5" />
rikitikitik
  • 2,414
  • 2
  • 26
  • 37
mariom64
  • 121
  • 1
  • 3
  • Just had the same issue and realized that `httpRuntime` was the chunk that was blocking. – Den Aug 26 '15 at 16:47
8

I had similar issue installing nopCommerce 2.80 on server. I use IIS7 net. 4.0 integrated pool. And just installed .net 4.5 from WebMatrix Products->Frameworks section. Restart will be required. Then it started to work.

ikutsin
  • 1,118
  • 15
  • 22
5

You have to update your application pool to .net 4.0 in IIS. It's probably set to 2.0 currently.

recursive
  • 83,943
  • 34
  • 151
  • 241
2

Chances are IIS doesn't have 4 installed (or if it is the site isn't specified to use it). Assuming you're running IIS7 have a look at this post:

Community
  • 1
  • 1
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
1

You just need to upgrade your .NET framework to ver 4.5 in your IIS 7.5 server you do that using the Microsoft web installer do a search for .NET and then installed the .NET framework version 4.5 and the all the apps that target that version will work

Cesar Vega
  • 455
  • 6
  • 15
0

you have to install .net framework 4.5 then it will works fine. "targetframework" attribute is not recognized by .net framework 4.0. So run the following command on command prompt and check either .net version 4.5 in installed on hosting machine or not.if not then install .net framework 4.5.it will work fine. run this command on cmd as follows.

wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version
Raj Baral
  • 661
  • 6
  • 19
Syed Zia
  • 3
  • 4
0

Run this: Microsoft .NET Framework Repair Tool

  • Make sure you run in offline mode if you need to run against servers that are firewalled off from the internet.
felickz
  • 4,292
  • 3
  • 33
  • 37