VBScript/IIS - 特定の Web サイトの ASP.NET バージョンを自動的に設定するにはどうすればよいですか
-
09-06-2019 - |
質問
IIS 6.0 でアプリ プールと Web サイトを作成するスクリプトを作成する必要があります。adsutil.vbs と iisweb.vbs を使用してこれらを作成できましたが、作成したばかりのサイトの ASP.NET のバージョンを 2.0.50727.0 に設定する方法がわかりません。
理想的には、adsutil.vbs を使用してメタベースを更新したいと考えています。どうすればいいでしょうか?
解決
@クリス ADSI の方法で私を殴ってください
これは、aspnet_regiis.exe ツールを使用して実行できます。マシンにインストールされている ASP.NET のバージョンごとに、これらのツールが 1 つあります。あなたは大金を投じることができます -
これにより 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 バージョンを変更する Web サイトを互換性のあるアプリ プールに切り替えることを忘れないでください。ASP.NET 1.1 サイトと 2.0 サイトは、同じアプリ プール内に混在しません。
他のヒント
次のスクリプトを見つけました 投稿されました Diablo Pup のブログで。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
所属していません StackOverflow