I have a very large and complex web application running .NET 3.5, with some classic ASP pages and VBScript components thrown in for good measure. The site is running on IIS7, and is a root website.
Ideally, I'd like to have a sub-application beneath this website which runs .NET 4, to deploy new components. However, this is presenting me with difficulties and the following error is showing:
The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the 'targetFramework' attribute from the element of the Web.config file.
Is this going to be possible at all, or should I give up and find another way?
It is possible.
You need of course to have both frameworks installed on the web server; then, you will need to configure the site's root to run using the 3.5 framework, and the folder (or virtual directory) where your sub-application resides to run using 4.0. You will need at least two appplication pools, one for 3.5 and the other for 4.0; you can use the default ones (they are created automatically when registering the frameworks with IIS) or create custom ones, it depends on the server's configuration.
If the sub-application is unrelated to your main site, this should be enough; if they need to "talk", things will get somewhat trickier, as the main site and the sub-application will actually run in two completely different runtime environment, even if they reside in the same web site structure.
Yes, you'll have to configure this sub-application to run with a different Application Pool. You can create another one to operate with .NET 4.
These articles should be helpful with specifics about how to do this:
You could (possibly should) also upgrade the entire site to .NET 4. Most everything should be backward compatible.
I got it working by removing
[targetFramework="4.0"]
from the[compilation]
node.VS 2010, MVC 4 -> .net 4.0, IIS 5.
Still have issues with routing but at least the default page works.