.NET Framework version...

Published 10/19/2005 by Henry in ASP.NET

I started working on a new project, the project runs on version 1.0 of the .NET Framework, on my development machine version 1.1 of the .NET Framework also is installed. Now the project gives exeptions becasue IIS runs it on the 1.1 Framework.

This is why I had to solve the following problem:
How do you tell one Web application to use the new version and the others to use the previous version?

The simple answer is to use the ASP.NET IIS Registration Tool, which is included with each version of the .NET Framework and usually is located at <WinDir>Microsoft.NETFramework<version>aspnet_regiis.exe.

In the case of an .aspx page, IIS loads the ASP.NET ISAPI extension (aspnet_isapi.dll) and passes it the request. The ASP.NET ISAPI extension then passes the request to the ASP.NET worker process, aspnet_wp.exe. Each version of the .NET Framework installs its own version of aspnet_isapi.dll and aspnet_wp.exe, how does IIS know which one to invoke for any particular .aspx page? You can find the answer in the IIS management console, located under the Administrative Tools section of the Control Panel.

To determine which version of ASP.NET is being used, open the IIS management console, right-click on the virtual directory or Web site, and select Properties. On the Directory or Home Directory tab, click on the Configuration button.
As shown in Figure 1, you should be on the Mappings tab, which displays a list of file extensions and the path to the corresponding CGI executable or ISAPI extension. The key here is to see which version of the ASP.NET ISAPI extension is being invoked for .aspx pages. For version 1.0 it should be <WinDir>Microsoft.NETFrameworkv1.0.3705aspnet_isapi.dll; for version 1.1 it should be <WinDir>Microsoft.NETFrameworkv1.1.4322 aspnet_isapi.dll.

ASP.NET Version 1.1
Version 1.1.4322

It now is possible to change this by selecting al extensions that use the .NET framework and click "Edit" to re- map the executable path for all the ASP.NET extensions to <WinDir>Microsoft.NETFrameworkv1.1.4322aspnet_isapi.dll., but what if you need to do this more often or have many websites to cover?
Using the IIS Registration Tool is straightforward. It has several options that let you install and uninstall not only the extension mappings but also the JavaScript files that perform client-side validation. You can do this for a virtual directory, an entire Web site, or all ASP.NET applications on the machine. Using the previous example, you can force the NewVersion Web application to use ASP.NET 1.1, by using this syntax:

aspnet_regiis -s W3SVC/1/ROOT/NewVersion

Watch out for a couple of possible pitfalls here. One thing to remember is your command prompt must be in the <WinDir>Microsoft.NETFrameworkv1.1.4322 directory; otherwise, there's no telling which version will be executed. The other thing to remember is the path to the virtual directory might not always begin with W3SVC/1/.
determine the path for the Web site you're working with. It is possible to do this by going to the Web site's Properties dialog and on the Web Site tab clicking the Properties button in the logging section. You should see the Log File Name at the bottom of the General Properties tab. This is the path you should use, minus the actual filename itself.

Logdirectory IIS

Another handy option for this tool is to view all the applications that are mapped to ASP.NET and which version they are mapped to. This is also another way to find the path name for the Web site. For this option, use this syntax:

aspnet_regiis -lk

This syntax will display something like this:

W3SVC/ 1.1.4322.0
W3SVC/1/ROOT/ 1.1.4322.0
W3SVC/1/ROOT/OldVersion/ 1.0.3705.288
W3SVC/1/ROOT/NewVersion/ 1.1.4322.0

Henry Cordes
My thoughts exactly...

Add comment

  Country flag
  • Comment
  • Preview