Changes to IIS are made to applicationHost.config or to a site’s web.config file(s). If settings are targeted at integrated mode, classic mode, bitness or framework version, that is achieved by filtering modules and handlers using the preCondition property. For example:
However, changes to ASP.NET require that you update each configuration file for every framework version. If you have ASP.NET 1.1, 2.0 and 4.0 on a 64-bit server, this means that you have five configurations to manage if you want to support all five combinations.
Here’s an example of the five paths to the config folders for the five paths mentioned above. Note that ASP.NET 1.1 only has a 32-bit version.
To edit the ASP.NET config files, you can edit them directly in your favorite editor like Notepad, UltraEdit, Notepad++, etc. That can be a lot of works and doesn’t allow you to automate it. Alternately, you can use tools like Configuration Editor or AppCmd.exe.
Configuration Editor at the site, application or path level
In Configuration Editor you can make changes at the server level or site/app level. If you make a setting at the site or application level, it either applies the setting in your site’s web.config file which works for all framework versions, or if it needs to make a change in the framework config files it will automatically know where to apply it based on the framework version defined on the application pool.
Configuration Editor at the server level
However, for a server level change you potentially have five files to target. You can change the framework version that Configuration Editor uses with the “Change .NET Framework Version” link in the Actions pane.
Unfortunately this doesn’t allow you to change the bitness. Hopefully we see that level of control in future versions.
There is a solution for AppCmd, and that’s what I needed for my situation today. I asked Carlos Aguilar Mares for assistance since I couldn’t find the answer elsewhere. My blog post is inspired by his answers so he gets the credit for the answers on how to target the framework versions.
With AppCmd you can target the framework version by using a combination of /clr:2 (or 4) and two different versions of AppCmd.exe. AppCmd.exe doesn’t currently have a way to target the framework version, but there are two versions of AppCmd available for you, each targeting different bitnesses. They are located at:
With this knowledge in hand, it’s easy to create powerful scripts to automate installations for you. Following is my example of how to set the trust level for all configurations. Take note of the path at the beginning and the /clr at the end.
With this in mind, you have full flexibility to target any ASP.NET configuration location that you need.