Change IIS ASP.NET Framework Version Programatically
I searched a good deal for a simple and easy way to change the target ASP.NET framework version for a Virtual Directory in IIS. To manually do this, you would normally open IIS and right-click the Virtual Directory you wanted to configure settings for. Then select Properties and you would be presented with a dialog like this:

To configure this setting programatically, you can use the application:
aspnet_regiis.exe
Here is the command to set a virtual directory to a specific framework version:
\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -s "w3svc/1/root/MyVirtualDirectoryName"
Where "MyVirtualDirectoryName" is the name of the virtual directory that you are changing settings for.
Here is a snippet of VBScript that runs changes the IIS ASP.NET framework version when run. This could be included in an installer or used to easily configure a server automatically:
Set WshShell = WScript.CreateObject("WScript.Shell")WshShell.Run("\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -s " & Chr(34) & "w3svc/1/root/WBID" & Chr(34), 1, TRUE)Save this script in a text file with a .vbs extension, then double click it to run the script.
Popular Articles
Last viewed:
- Installing the SMTP Service on Windows 2003 Server
- ASP.NET CSS Highlight TextBox on Focus
- C# Free Component to Generate PDF - Convert HTML to PDF
- MySQL Administrator - Can't see with Remote Desktop session connecting to Multiple Monitor Workstation
- SQL Server Management Studio Mulit-select Items to Delete
- Use FileZilla to Connect to a Windows FTP Server
Similar
- Fixing Relative Paths in C# ASP.NET When Using Url Rewriting
- How to Highlight the Day in the ASP.NET Calendar Control with the SelectedDate Property
- Global.asax Events in IIS 6 and IIS 7 for Static Resources
- Create a Windows-style GroupBox in ASP.NET
- Changing the Application Pool Identity with Windows Server 2008 and IIS 7


Recent comments
11 hours 45 min ago
17 hours 19 min ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
1 week 4 days ago
2 weeks 13 hours ago
2 weeks 14 hours ago
2 weeks 14 hours ago
2 weeks 17 hours ago