使用MSDeploy和TFS 2010设置应用程序池 [英] Set application pool with MSDeploy and TFS 2010
问题描述
我正在尝试使用MSDeploy部署网站,并使用其中的一部分构建团队...
I'm trying to deploy website with MSDeploy and team build using some of this ...
/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"
有没有办法在自定义应用程序池中设置此网站?
Is there a way to set this website in custom application pool?
推荐答案
如果您使用的是IIS 7,则可以使用appPoolProvider将应用程序池同步到远程服务器。请参阅:
If you're using IIS 7, you can use the appPoolProvider to sync application pools to a remote server. See:
http://technet.microsoft.com/en-us/library/dd569070(WS.10).aspx
和
http://blog.torresdal .net / 2010/08/16 / NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx
然而,我无法真正做到这一点,如果你'重新使用IIS 6无论如何都无法使用。你可以做的是利用MSDeploy在远程服务器上运行几个命令来设置应用程序池(并在网站上注册.NET版本)。
However, I wasn't able to really get that to work well, and if you're using IIS 6 this won't work anyway. What you can do though is leverage MSDeploy to run a couple commands on the remote server to set the application pool (and register the .NET version on the website).
首先,创建一个包含类似于以下内容的批处理文件:
First, create a batch file that contains something similar to the following:
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/<IIS number>/Root/<virtual directory>/AppPoolid "<app pool name>"
因此,如果IIS编号为1,则您的虚拟目录为MyDirectory,而App Pool为命名为.NET4.0,命令为。
So, if the IIS number is 1, your virtual directory is "MyDirectory" and the App Pool is named ".NET4.0", the command would be.
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/1/Root/MyDirectory/AppPoolid ".NET4.0"
然后,您可以运行MSDeploy,将此批处理文件作为参数传递并在远程计算机上运行:
You can then run MSDeploy, passing this batch file in as an argument and running it on the remote machine:
MSDeploy
-verb:sync
-source:runCommand="<path to batch file>",waitinterval=5000
-dest:auto,computername=<computer name>
其中<批处理文件的路径>
是您刚才创建的批处理文件的完整路径,并且是您要运行它的计算机。以下是描述 runCommand
参数的链接: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspx
where <path to batch file>
is the full path to the batch file you just created above, and is the computer against which you want to run this. Here is a link describing the runCommand
argument: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspx
我相信你可以把它设置为TFS中的构建步骤。我们创建了一个.NET实用程序,我们将其作为部署过程的一部分,创建这些批处理文件并运行MSDeploy命令。
I'm sure you can set this up as a build step in TFS. We made a little .NET utility that we call as part of our deployment process that creates these batch files and runs the MSDeploy command.
您还可以执行其他操作在这个可能对您有用的方法中:
注册IIS版本:
There are also other things you can do in this same method that might prove useful to you:
Register an IIS version:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
-s w3svc/1/root/MyDirectory
创建应用程序池:
CSCRIPT //nologo %dir%\adsutil.vbs
CREATE w3svc/AppPools/AppPoolName IISApplicationPool
感谢 http://justsamson.com/2010/06/14/create-virtual-directory-in-iis-6-0-via-command-line/ 让命令行脚本执行各种功能。
Thanks to http://justsamson.com/2010/06/14/create-virtual-directory-in-iis-6-0-via-command-line/ for the command-line scripts to do the various functionality.
这篇关于使用MSDeploy和TFS 2010设置应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!