I've been developing an ASP.NET 4.0 application on my local machine, and today I tried to deploy it to the server. After deploying, I got the following message when trying to visit the site in my browser:
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Ok, no problem. That means the server's still running ASP.NET 2.0. I'll just upgrade it, right?
It hasn't been that simple.
First I installed the .NET Framework v4.0. I followed the instructions that I found at this link to enable the ASP.NET ISAPI DLLs in IIS. When I run "cscript iisext.vbs /listfile " I can see the ASP.NET 4.0 DLLs listed, and that they're enabled. However, the behavior of my application hasn't changed. I still get the same error message.
I suspect I need to change the ASP.NET version in the web site configuration in IIS. However, I can't find any way of doing so. When I right-click on either the website, the virtual directory housing my application, or the application pool in IIS, and then click "Properties" from the context menu, I expected to find an "ASP.NET" tab among the properties pages that would let me change the ASP.NET version for that site/application. However, there is no "ASP.NET" tab or properties page for some reason. Why not? How do I fix this and switch my app to .NET 4.0?
Again, this is Windows Server 2003 R2, I believe the IIS version is 6.
I think this will take you to the right direction:
How To Switch Website To ASP.NET4.0 in Windows Server 2003 IIS6.0
Try running aspnet_regiis.exe -i from the .Net 2.0 framework directory if ASP.NET-tab is missing.
Edit: if ASP.NET-tab still missing:
Uninstall IIS (including ASP.Net)
Reboot the machine.
Reinstall IIS + ASP.net
Run aspnet_regiis -ir
Edit2: As why the ASP.net tab is missing, this post might give some clues.
".. Apparently on Windows Server 2003 64 Bit Editions and Windows Server 2003 R2 the ASP.NET Tab in IIS doesn't appear, no fix, that's it, it's gone! .... The ASP.NET tab does not appear on x64-based editions of Windows Server 2003 and Windows Server 2003 R2. This tab also does not appear if only one version of ASP.NET is allowed in the web service extensions."
I know an answer was already accepted on this, but this same error can also occur if your site is simply using the wrong app pool. Make sure you have a .net 4.0 app pool or an asp.net 4.0 app pool set as active for the web app and also make sure that the app pool itself is started.