2

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

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

4

2 回答 2

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

You probably already know this, but if you have multiple 1.1 and 2.0 sites on your machine, just remember to switch the website you're changing ASP.NET versions on to compatible app pool. ASP.NET 1.1 and 2.0 sites don't mix in the same app pool.

于 2008-08-21T20:01:43.327 回答
2

我在 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 
于 2008-08-21T19:49:31.780 回答