Saturday, March 26, 2005
DLL Hell was a Walk in the Park in Comparison
In comparison to what? In comparison to trying to run two versions of the .Net framework on one PC. And you thought side-by-side versioning was supposed to be easy with .Net.I, like many others, have installed VS2005 Whidbey on one of my PC's - my laptop, to be specific. As soon as I installed VS2005, I could no longer debug ASP.Net projects in VS2003; I could, however, still code ASP.Net pages with VS2003. Over time, I have reloaded the OS on my laptop, re-installed both versions of .Net, and done who-knows-how-many other things, with the net result that I was no longer able to open any ASP.Net 1.1 projects or create new projects. I tried all the usual things (at least the usual things within my experience), such as running aspnet_regiis -i, with no success before getting serious about solving the problem.
The solution, you ask? Ok. First, for the benefit of search engines, here's the error message I was getting when trying to create a new ASP.Net app with VS2003:
Visual Studio .NET has detected that the specified web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services.
First, I tried running
aspnet_regiis -iwhich didn't help at all. After some research, I tried running
aspnet_regiis -uawhich uninstalls all versions of ASP.Net and followed that with -i again on version 1.1. While that did not solve it, it did reveal the real source of the problem! I got a new error message:
Visual Studio .NET has detected that ASP.NET applications and services are locked down in IIS.
The solution to this one was as easy as clicking the help button on the message box. It took me to the answer in my VS2003 help in MSDN. The installation of VS2005 configures IIS to prohibit the execution of ASP.NET v1.1.4322 applications! That second error message is what should have been given in the first place. It would have saved me and others hours of troubleshooting. Though I could not find the exact article in the online version of MSDN, here's a different article that describes the same problem and solution as it relates to version 1.0 versus version 1.1:
http://support.microsoft.com/default.aspx?scid=kb;en-us;817267
All I had to do was to allow v1.1.4322 applications to run. At this point, I was able to run v1.1.4322 applications but could not debug them. Back to square one. Or to square two, perhaps.
To solve the debugging problem, I used Dennis Bauer's ASP.NET Version Switcher. This is a handy tool that simply runs aspnet_regiis, with the appropriate switches, to set specific applications to run the version of ASP.Net that you need them to run. It displays the command line for aspnet_regiis that it uses so it is a good educational tool, as well. The key to this portion of the solution is aspnet_regiis -s
In summary,when you install a second version of ASP.NET on a server, and need both versions to function, here are the steps:
1. Do this before even thinking about the rest. If this isn't right, none of the rest can work. Follow the steps outlined in http://support.microsoft.com/default.aspx?scid=kb;en-us;817267 to be sure that both (or all three?) desired versions of ASP.NET are permitted in your current IIS configuration.
2. Run aspnet_regiis -s<path> from c:\%WINDIR%\Microsoft.Net\Framework\%ASPNET Version%\, replacing <path> with the path to your default wwwroot directory, %WINDIR% with the name of your Windows directory and %ASPNET Version% with the version number you want to run, such as:
C:\Windows\Microsoft.Net\Framework\v1.1.4322\aspnet_regiis -s "C:\Inetpub\wwwroot"If this is confusing to you (and it sure was to me!) then download Dennis Bauer's ASP.NET Version Switcher. This is a handy tool that allows you to set which version of ASP.NET any specific ASP.NET application will run under. It does its magic by taking the confusion out of aspnet_regiis and even displays the command line that it uses so you may learn something in the process. I did.
With that, running side-by-side versions of ASP.NET has just become the same walk in the park that DLL Hell was. What an improvement!


