我需要编写在 IIS 6.0 上创建应用程序池和网站的脚本。我已经能够使用 adsutil.vbs 和 iisweb.vbs 创建这些,但不知道如何将我刚刚创建的网站的 ASP.NET 版本设置为 2.0.50727.0。

理想情况下,我想使用 adsutil.vbs 来更新元数据库。我该怎么做呢?

有帮助吗?

解决方案

@克里斯 在 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 站点不会混合在同一个应用程序池中。

其他提示

我找到了以下脚本 发布 在 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 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top