VBScript/IIS – Wie stelle ich die ASP.NET-Version automatisch für eine bestimmte Website ein?
-
09-06-2019 - |
Frage
Ich muss ein Skript für die Erstellung von App-Pools und Websites auf IIS 6.0 erstellen.Ich konnte diese mithilfe von „adsutil.vbs“ und „iisweb.vbs“ erstellen, weiß aber nicht, wie ich die Version von ASP.NET für die Websites, die ich gerade erstellt habe, auf 2.0.50727.0 festlegen soll.
Idealerweise würde ich gerne die Datei „adsutil.vbs“ verwenden, um die Metabasis zu aktualisieren.Wie mache ich das?
Lösung
@Chris Auf dem ADSI-Weg war ich schneller als ich
Sie können dies mit dem Tool aspnet_regiis.exe tun.Für jede auf dem Computer installierte ASP.NET-Version ist eines dieser Tools vorhanden.Du könntest etwas berappen –
Dadurch wird ASP.NET 1.1 konfiguriert
%windir%\microsoft.net\framework\v1.1.4322\aspnet_regiis -s W3SVC/[iisnumber]/ROOT
Dadurch wird ASP.NET 2.0 konfiguriert
%windir%\microsoft.net\framework\v2.0.50727\aspnet_regiis -s W3SVC/[iisnumber]/ROOT
Sie wissen das wahrscheinlich bereits, aber wenn Sie mehrere 1.1- und 2.0-Sites auf Ihrem Computer haben, denken Sie daran, die Website, auf der Sie die ASP.NET-Versionen ändern, auf einen kompatiblen App-Pool umzustellen.ASP.NET 1.1- und 2.0-Sites werden nicht im selben App-Pool gemischt.
Andere Tipps
Ich habe das folgende Skript gefunden Gesendet auf dem Blog von Diablo Pup.Es nutzt ADSI-Automatisierung.
'******************************************************************************************
' 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