6

I try to publish a web application from my VS2012 to a remote computer. I published the files but when I try to open the website, I get 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: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:

Line 41: 
Line 42:     <compilation targetFramework="4.0" />
Line 43:     <httpRuntime targetFramework="4.0" />
Line 44:     <authentication mode="Forms">   
Line 45:       <forms loginUrl="~/" timeout="2880" />

(line 43 is in red )

On the remote computer : * IIS7 is installed (and also IIS6, I think) * ASP.NET 4.0 is installed * "aspnet_regiis -ir" > installed successfully * IIS7 > Application Pools > ASP.NET 4.0 > poining to ".NET Framework v4.0.30319" * IIS7 > my web application > "ASP.NET 4.0" (Integrated) is chosen. I don't know if it 's important but server's windows is Widows Server 2008 RT Enterprise 64-bit and my computer is windows 7 32-bit.

Nothing helped...

enter image description here enter image description here

TamarG
  • 3,522
  • 12
  • 44
  • 74
  • Are you sure 4.0 is chosen? I got that error when the web site was setup to use ASP.NET 2.0... – Brian Mains Jul 07 '13 at 09:11
  • Can you post a screenshot of the selected app pool for your application? The error you're getting really does mean that ASP.NET 2.0 is trying run your application. See [this canonical post](http://stackoverflow.com/questions/7530725/unrecognized-attribute-targetframework-note-that-attribute-names-are-case-sen) – sq33G Jul 07 '13 at 09:19
  • I edited the question and added 2 screenshots... – TamarG Jul 07 '13 at 09:29

2 Answers2

7

The httpRuntime did not have targetFramework available for set, remove it and it will work.

Aristos
  • 66,005
  • 16
  • 114
  • 150
  • I get a different error - "Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. " – TamarG Jul 07 '13 at 09:58
  • @TamarG This is your real error, remove it and solve the next error. – Aristos Jul 07 '13 at 09:58
  • 1
    @TamarG for the next error look: http://stackoverflow.com/questions/10896894/webapi-rc-system-runtime-compilerservices-extensionattribute-from-assembly-ms – Aristos Jul 07 '13 at 10:00
  • 1
    I installed .net 4.5 on the target server and it worked. Thank you! – TamarG Jul 07 '13 at 11:04
1

I had similiar issue when I try to publish the website.

The code compiled fine in both Debug and Release but got Unrecognized attribute 'targetFramework'... while publishing the site after updating my solution to .net 4.7.2 from older version .net3.5

I then updated my .pubxml file to contain

**<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>**

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <WebPublishMethod>FileSystem</WebPublishMethod>

It worked for me then

Amit Sharma
  • 133
  • 8