After I installed .Net Framework v 4.0 I created the new website but when I chose the ASP.NET version 4.0.30319 I got the message:
Changing the Framework version requires a restart of the W3SVC service. Alternatively, you can change the Framework version without restarting the
W3SVC service by running: aspnet_regiis.exe -norestart -s IIS-Viirtual-Path
Do you want to continue (this will change the Framework version and restart the W3SVC service)?
As we host a large number of criticial websites I didn’t want to restart IIS but when I tried to run the command line that they suggested would make the change dynamically I couldn’t seem to get the ‘IIS-Virtual-Path’ syntax correct.
After a search similar issues pointed to using the aspnet_regiis -lk command to display site id’s but this command only displays high level ID’s rather than individual websites or virtual directories that are in sub directories.
I finally found this excellent post which put me on the right track:
I followed the advice and right clicked on my new website and selected All Tasks > Save configuration to a file
Unlike the post I didn’t have an ‘IIsWebServer Location’ but instead an ‘IIsWebVirtualDir Location’ which was in the format /W3SVC/1/Root/MyNewWebsite
I then ran the command (from C:WINDOWSMicrosoft.NETFrameworkv4.0.30319 or whichever ASP.NET version you wish to register from)
aspnet_regiis -norestart -s W3SVC/1/Root/MyNewWebsite
This registers the .NET version change recursively to the website.