SoFunction
Updated on 2025-03-09

IIS to change the implementation method of program version with batch code

In iis6.0 in Windows 2003, after installing .NETFRAMEWORK1.1, and .NETFRAMEWORK2.0, in the newly created application, check the properties and the tab will appear. Here you can change which framework the WEB application is based on.

However, after installing the 64-bit WINDOWSXP PROFESSIONAL recently, this tab cannot be found, so it can only be modified by the following methods:

In IIS Manager, select the specified WEB application, right-click -->Properties -->configuration -->mapping -->Modify the mapping as needed

However, this method is too troublesome and cannot be modified in batches. Using the following batch command, you can easily implement framework specification:

  

Copy the codeThe code is as follows:

@echo off 

set   /p   vp="please input the virtual path:" 

choice /c otc /m "press o for asp.net1.1, press t for asp.net2.0, press c for cancel" 

if errorlevel 3 goto end 
if errorlevel 2 goto two 
if errorlevel 1 goto one 

:one 
%SYSTEMROOT%Microsoft.NETFrameworkv1.1.4322aspnet_regiis.exe -s W3SVC/1/ROOT/%vp% 
goto end 

:two 
%SYSTEMROOT%Microsoft.NETFrameworkv2.0.50727aspnet_regiis.exe -s W3SVC/1/ROOT/%vp% 
goto end 

:end 
echo end 
pause 
 

After setting up, remember to modify the application pool. Programs based on different versions of the framework cannot use the same application pool!!!