首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为特定网站自动设置ASP.NET版本

如何为特定网站自动设置ASP.NET版本
EN

Stack Overflow用户
提问于 2008-08-21 19:39:44
回答 2查看 5.4K关注 0票数 2

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

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2008-08-21 20:01:43

@Chris在ADSI的方式上比我先一步

您可以使用aspnet_regiis.exe工具完成此操作。计算机上安装的每个ASP.NET版本都有一个这样的工具。你可以付钱给-

这将配置ASP.NET 1.1

代码语言:javascript
复制
%windir%\microsoft.net\framework\v1.1.4322\aspnet_regiis -s W3SVC/[iisnumber]/ROOT

这将配置ASP.NET 2.0

代码语言:javascript
复制
%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站点不能混合在同一个应用程序池中。

票数 6
EN

Stack Overflow用户

发布于 2008-08-21 19:49:32

我在Diablo Pup的博客上找到了下面的脚本posted。它使用ADSI自动化。

代码语言:javascript
复制
'******************************************************************************************
' 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 
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档