使用 MSDeploy 和 TFS 2010 设置应用程序池

发布于 2024-10-08 06:49:36 字数 286 浏览 6 评论 0原文

我正在尝试使用 MSDeploy 来部署网站,并使用其中的一些进行团队构建...

/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"

有没有办法在自定义应用程序池中设置此网站?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

翻身的咸鱼 2024-10-15 06:49:36

如果您使用的是 IIS 7,则可以使用 appPoolProvider 将应用程序池同步到远程服务器。请参阅:

http://technet.microsoft.com/en- us/library/dd569070(WS.10).aspx

http: //blog.torresdal.net/2010/08/16/NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx

但是,我无法真正让它正常工作,如果您使用的是 IIS 6,那么无论如何这都不起作用。不过,您可以利用 MSDeploy 在远程服务器上运行几个命令来设置应用程序池(并在网站上注册 .NET 版本)。

首先,创建一个包含类似于以下内容的批处理文件:

cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs 
  SET w3svc/<IIS number>/Root/<virtual directory>/AppPoolid "<app pool name>"

因此,如果 IIS 编号为 1,您的虚拟目录为“MyDirectory”并且应用程序池名为“.NET4.0”,则命令将为。

cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs 
  SET w3svc/1/Root/MyDirectory/AppPoolid ".NET4.0"

然后,您可以运行 MSDeploy,将此批处理文件作为参数传递并在远程计算机上运行它:

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

我确信您可以将其设置为 TFS 中的构建步骤。我们制作了一个小的 .NET 实用程序,将其作为部署过程的一部分进行调用,用于创建这些批处理文件并运行 MSDeploy 命令。

您还可以使用相同的方法执行其他可能对您有用的操作:
注册 IIS 版本:

%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/ 用于命令行脚本来执行各种功能。

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

and

http://blog.torresdal.net/2010/08/16/NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx

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>"

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"

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>

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

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.

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  

Create an App Pool:

CSCRIPT //nologo %dir%\adsutil.vbs 
  CREATE w3svc/AppPools/AppPoolName IISApplicationPool  

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.

嘿咻 2024-10-15 06:49:36

部分技巧在于 /p:IncludeAppPool=true。这会更改部署脚本以启用 AppPoolExtension。但我还没有弄清楚如何最好地实际设置应用程序池。 :)

Part of the trick is with /p:IncludeAppPool=true. That changes the deploy script to enable AppPoolExtension. But I haven't figured out how best to actually set the app pool yet. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文