Thursday, April 21, 2011

Using aspnet_regiis to change the ASP.Net version of a single site on a web server

We would like to change a web site from version 1.1 to 2.0.50727 during the installation of a solution.

We would prefer a solution that could do this in code.

We can do this by running Aspnet_regiis -i . However, this has a drawback that it changes the version for all sites on the server, and the customer may have other sites that we should not change.

Is there a way to do this in code?

Is there a way to run Aspnet_regiis such that it only affects a single site on the web server?

From stackoverflow
  • Is there a way to run Aspnet_regiis such that it only affects a single site on the web server?

    Yes.

    Run aspnet_regiis -? and it will list all its options, including how to specify a virtual directory (it will include all child virtual directories as well).

  • For a virtual directory use:

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis /s W3SVC/1/ROOT/<YourVirtualDirectoryName>
    

    Where 1 (W3SVC/1/ROOT) is the website id.

  • Found a similar question on stackoverflow with an answer that used code:

    http://stackoverflow.com/questions/1299084/iis-6-0-directoryentry-scriptmaps-property-and-set-net-version

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.