2008-08-21 59 views

回答

6

@Chris打我衝在ADSI方式

您可以使用ASPNET_REGIIS.EXE工具做到這一點。機器上安裝的每個版本的ASP.NET都有這些工具之一。你可以掏出來 -

這將配置ASP.NET 1.1

%windir%\microsoft.net\framework\v1.1.4322\aspnet_regiis -s W3SVC/[iisnumber]/ROOT 

此配置ASP.NET 2.0

%windir%\microsoft.net\framework\v2.0.50727\aspnet_regiis -s W3SVC/[iisnumber]/ROOT 

您可能已經知道這一點,但如果你有多個1.1和2.0請記住將要更改ASP.NET版本的網站切換到兼容的應用程序池。 ASP.NET 1.1和2.0站點不會混合在同一個應用程序池中。

2

我在Diablo Pup的博客上找到了以下腳本posted。它使用ADSI自動化。

'****************************************************************************************** 
' Name: SetASPDotNetVersion 
' Description: Set the script mappings for the specified ASP.NET version 
' Inputs: objIIS, strNewVersion 
'****************************************************************************************** 
Sub SetASPDotNetVersion(objIIS, strNewVersion) 
Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap 
Dim strSearchText, strReplaceText 

Select Case Trim(LCase(strNewVersion)) 
    Case "1.1" 
    strReplaceText = "v1.1.4322" 
    Case "2.0" 
    strReplaceText = "v2.0.50727" 
    Case Else 
    wscript.echo "WARNING: Non-supported ASP.NET version specified!" 
    Exit Sub 
End Select 

ScriptMaps = objIIS.ScriptMaps 
arrVersions(0) = "v1.1.4322" 
arrVersions(1) = "v2.0.50727" 
'Loop through all three potential old values 
For Each thisVersion in arrVersions 
    'Loop through all the mappings 
    For thisScriptMap = LBound(ScriptMaps) to UBound(ScriptMaps) 
    'Replace the old with the new 
    ScriptMaps(thisScriptMap) = Replace(ScriptMaps(thisScriptMap), thisVersion, strReplaceText) 
    Next 
Next 

objIIS.ScriptMaps = ScriptMaps 
objIIS.SetInfo 
wscript.echo "<-------Set ASP.NET version to " & strNewVersion & " successfully.------->" 
End Sub