How to change the asp.net version of a domain on the command line ?
Posted by - NA -, Last modified by Randi O on 27 April 2016 09:02 PM


Firstly you will need to find what folder the version of .net you want to use is located and you will need to know what number IIS has assigned the domain you want to change.

For example if you wanted to set up .net 2.0 and configure a domain to use it the folder is most likely the following:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

If you look up the domain in IIS Manager you should see what number it is using*

Once you have confirmed the directory you can open a command prompt in Windows:
Start >> run >> type in 'cmd' and press enter

In here you can change to the directory in question:
cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

If you run the following command you can see the different vhosts (domains) on the server and what version of .net they currently have installed:
aspnet_regiis /lk

A sample output of this would be (please see below for how to tie these numbers to a domain name*):
W3SVC/14382/ROOT/ 1.1.4322.573
W3SVC/17058/ROOT/ 1.1.4322.573
W3SVC/17090/ROOT/ 1.1.4322.573
W3SVC/17123/ROOT/ 1.1.4322.573

To add .net 2.0 to a vhost we run:
aspnet_regiis /sn *vhost*

where *vhost* is the vhost name taken from the above results.

For example to set W3SVC/17058/ROOT/ to .net 2.0 we do:
default path> cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
then:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> aspnet_regiis /sn W3SVC/17058/ROOT


If you run the 'aspnet_regiis /lk' command again it will look something like this:
W3SVC/14382/ROOT/ 1.1.4322.573
W3SVC/17058/ROOT/ 2.0.50727.0
W3SVC/17090/ROOT/ 1.1.4322.573
W3SVC/17123/ROOT/ 1.1.4322.573

*You can find out what the number between W3SVC and ROOT is through the IIS Manager on the server.


Powered by TurnKey Internet]]>