Went through some interesting configurations today and wanted to document it.
Our client has a server, Windows Server 2003 SP2, in which we already have many ASP.NET 2.0 applications running, including some serving up Silverlight 3.0. We needed to migrate one of our applications to ASP.NET 4.0 and Silverlight 4. It was a little more involved than I would’ve thought.
Here’s the steps:
Install the .NET 4.0 Framework on the server.
This did not require a server reboot. I have yet to have a reboot required when installing a .NET Framework version. Perhaps I’ve been lucky so far. This is important because you don’t want to disrupt folks using the resources on the box.
Create a separate App Pool for the web applications that are going to run under .NET 4.0.
From what I understand, you can’t have different web applications running under the same application pool. Since this box has production and beta applications on it already, we need to create an app pool. Nothing fancy.
Create the new virtual directory for the new application and assign it your new app pool
Nothing fancy here. Use the properties dialog to create the application and assign the app pool.
Install the scriptmaps for ASP.NET 4.0 to the new web application.
If you don’t do this step and you try to run the application under 2.0 you will get error:
Unrecognized attribute 'targetFramework'
This is because the web.config is different now and contains a new attribute on the compilation element.
If you try and set the ASP.NET version using the properties panel, you will get a warning that you are going to cause a restart of the entire W3SVC service therebye killing all the work anyone may be in the middle of using existing applications.
Since we don’t want to disrupt currently running applications, we need to do this through the command line.
Open a cmd prompt and navigate to the v4 Framework directory: %WINDIR%\Microsoft.NET\Framework\v4.0.30319. Once there, we can use the administration utility to change the application.
1: aspnet_regiis.exe -s W3SVC/1/ROOT/SampleApp1
Here’s an example of the output when doing this against a test application.
Enable ASP.NET v4.0.30319 web service extension
If you try to hit the web application prior to this step you will receive ‘The page cannot be found’.
Enable the new version ASP.NET by using the Web Service Extensions node in IIS 6 and switching ASP.NET v4.0.30319 from Prohibited to Allowed.
From here you should be done and can now use your application right alongside older ones on the same web server.