Unrecognized attribute 'controlRenderingCompatibilityVersion' - asp.net

We are replacing our win2k3 server (iis6) with a win2012 (iis8) and when we move the asp.net apps over from the old server, configure them as applications and point them to the 2.0 framework, then attempt to run we get this:
Unrecognized attribute 'controlRenderingCompatibilityVersion'
Line 2: <configuration>
Line 3: <system.web>
Line 4: <pages controlRenderingCompatibilityVersion="4.5" />
Line 5: </system.web>
Line 6: </configuration>
Version Information: Microsoft .NET Framework Version:2.0.50727.6407; ASP.NET Version:2.0.50727.6406
I have been trying things all day and the strange thing is that the source file points the IIS's root web.config even though the application has it's own with the tag.
Please note this is a legacy app that cannot be updated to asp.net 4+.
Any help would be appreciated.

Found something that worked for me finally. I did the manual conversion of the web.config in this link:
http://msdn.microsoft.com/en-us/library/dd483478(v=vs.100).aspx
Then I upgraded the app pool to 4.5 (4 was not an option for me but it might be for you).

Related

ASP.NET MVC4 to 5 Upgrade

I have had to take a very old project out of it's dusty box and upgrade it from 4 to 5 and I followed the guidance on the MS Site (https://learn.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2) and it all works perfect locally on my dev machine. Yep it works on my machine so ship it right....
Well No because I publish to the server and this is where the issues start as I keep getting errors saying:
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
element of the Web.config file is used only to target
version 4.0 and later of the .NET Framework (for example,
''). 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.
I have checked that the Web.Config file has the Target set to 4.7.1 and on the server the current version is 4.7.2 so where am I going wrong.
The line in the Web.Config that is being referenced is:
<compilation debug="true" targetFramework="4.7.1" />
And at the bottom of the error page:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2106.0
I like my local machine too much to ship it to the cloud so someone please help. I have been bashing my head against the desk for hours now and Google/Bing etc are not helpful.
Have you tried to install "Runtime" SDK on the server?
The runtime SDK for Framework 4.7.1 can be found here:
https://www.microsoft.com/net/download/visual-studio-sdks
If you haven't done it, try it!
Probably you don't have the .Net version in the hosting server just install the .Net version in the server.
.Net 4.7.1 Offline Installer
Thanks for the responses but this site is hosted on a shared hosting platform so I can't install anything, but I checked and they have 4.7.2 installed.
I fixed the problem by removing the targetFramework from the compilation settings and worked a treat.
Old:
<compilation debug="true" targetFramework="4.7.1" />
New:
<compilation debug="true" />
Thanks for the help. Now onto the next issue.

Which .net version is used ? The one in web conifg or the one used while building?

Probably a noob question but what version of .NET is used in a ASPX web application? Is it the version defined in the project propperties or the one defined in the web.config file of the website?
I need to know this because an API I am using in the web application is closing all non TLS1.2 protocolls. And as far as I understand TLS1.2 is the default in .NET 4.5. The server is Windows Server 2008.
Visual Studio uses web.config values to initialize the property pages. So, they're one in the same.
You see the .NET version from the property pages in the web.config similar to this:
<configuration>
<system.web>
<compilation targetFramework="4.5" />
</system.web>
</configuration>
If you change the target framework in the project properties and save, you should see the updated target framework in that value in your web.config file.

Setting up an ASP.NET website

I am trying to set up a web site for my new business, Antech, but I can't seem to get my landing site to point to 'Default.aspx'. Do I have to use IIS and if so does IIS Express work? I am continually coming up with the following error in my Web.config file (to see the actual error you can go to my website here):
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 24: </connectionStrings>
Line 25: <system.web>
Line 26: <compilation debug="true" targetFramework="3.5">
Line 27: <assemblies>
Line 28: <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Source File: \\boswinfs07\home\users\web\b341\dom.antechdevelopmen\web.config Line: 26
Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634
Thanks for your help in advance!
It could be because of two reasons:
The application pool of your site could be set for .net framework 2.0
.Net 4.0 is not installed on your machine.
Try changing your app pool to 4.0.
If app pool doesn't have 4.0 framework listed, you might want to register it. For same follow below link that shows how to do it.
https://stackoverflow.com/a/4890368/309395
It looks like your application pool is set to .Net framework 2.0.
The targetFramework attribute was only introduced in .Net 4.0. You can either manually remove the targetFramework="3.5" from the config file, or change your app pool to .Net framework 4.0
From http://msdn.microsoft.com/en-us/library/bb398791.aspx :
Visual Studio automatically inserts the targetFramework attribute when you upgrade a project to the .NET Framework 4. It removes the attribute when you change a project's target from the .NET Framework 4 to an earlier version.

asp.net web-config error

I have still problem with asp.net project. In Visual studio when i start debug it is all good and page working but, when i try it on iis7 showse this error.
SHOW 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 18: </connectionStrings>
Line 19: <system.web>
Line 20: <compilation debug="true" targetframework="4.0" />
Line 21: </system.web> Line 22:
Source File: C:\inetpub\wwwroot\web.config Line: 20
It seems problem with targetFramework but i do not know if i have to configure iis server or something chane in my web-config.
thx.
Change the .NET version on the Application pool for your website.
It must be .NET 4.0, not the .NET 2.0
View a List of Application Pools (IIS 7)
Ensure the application pool is set to use .NET 4.0.
Change your application pool to be compatible with .NET 4.0.
Open IIS then click on an application pool on the list and modify it to use .NET Framework 4.0.

System.ServiceModel.Activation.HttpModule error

what is the cause of this error on below line?
<system.web>
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fa-IR" uiCulture="fa-IR" />
<compilation targetFramework="4.0" debug="true">
<assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.
Though this is a valid solution (as explained beautifully here)
but it did not work with Windows 8.
For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".
Thanks
Neha
This happens when you install .Net 4 before enabling IIS, or if you register WCF after registering .Net 4. In either case, your App Pools will be running .Net 2.0 (which is the CLR version required for .Net 3 if you have registered WCF, which installs ASP.Net 3.5, or the default if you have installed IIS after .Net 4)).
There are many references to this on the web, e.g. the MSDN blogs:
http://blogs.msdn.com/b/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx
The fix is to re-register ASP.Net 4 from the correct (32 or 64 bit) Framework folder (Framework64 on a 64bit server), using the aspnet_regiis.exe tool, e.g.
aspnet_regiis.exe -iru
For Windows 8 you need to Windows features and enable everything under .Net Framework 3.5 and .Net Framework 4.5 Advanced Services -> Enable Everything
For windows 8 the above configuration in
Control panel->programs->windows features on/off
enable every thing under".net Framework3.5" and ".net Framework 4.5 advanced Services"
Working fine for me.
Thanks Madhavi.B
I had this problem on a server managed by one of our clients. I didn't have the access to run the aspnet_regiis.exe tool. As a workaround I did the following:
I removed aspNetCompatibilityEnabled="true" from the <serviceHostingEnvironment> tag in the web.config
removed [AspNetCompatibilityRequirements] from the webservice.cs file
Unfortunately this means that for example HttpContext.Current becomes null, I could fix my webservice by rewriting all my HttpContext.Current.Server.MapPath calls to System.Web.Hosting.HostingEnvironment.MapPath
Hope this helps someone.
This problem surfaced for us immediately after we installed the Windows Management Framework 3.0/PowerShell 3.0 sp1 (KB2506143) on a Windows Server 2008 R2 x64. Windows Update then also installed KB2736422, KB2756921, and KB2656411 immediately after.
Our solution was to first uninstall KB2506143 (and the three updates that accompanied that), then run aspnet_regiis.exe -iru as suggested in Ed209's response above. Both steps were necessary to resolve the problem. Thank you, Ed209.
appcmd.exe set config -section:system.webServer/modules /[name='ServiceModel'].preCondition:"managedHandler,runtimeVersionv2.0" /commit:apphost
worked for me

Resources