如何控制用于通过VS&进行部署的AppPool? MSDeploy设置

如何控制用于通过VS&进行部署的AppPool? MSDeploy设置

问题描述:

当我为我的web应用程序构建部署软件包时,该软件包包含一个archive.xml文件,其中包含以下内容:

When I build a deploy package for my webapp the package contains an archive.xml file that contains the following:

<createApp
    applicationPool=""
    MSDeploy.applicationPool="1"
    appExists="True"
    MSDeploy.appExists="1"
    ... />

问题:

如何控制安装Webapp的应用程序池,并在某些情况下创建新的应用程序池?是否可以更改VS设置来控制上述输出,否则会影响部署时应用程序池的方式?

Question:

How can I control the application pool that the webapp gets installed into and, in some cases, create a new application pool? Are there VS settings that I can change to control the above output or otherwise affect how the application pool at deploy time?

根据一个帖子我可以通过添加以下选项来告诉msbuild使用应用程序池,但在生成的输出中看不到任何差异:

According to one SO post I can tell msbuild to use an app pool by adding the following option but I couldn't see any difference in the generated output:

/p:IncludeAppPool=true

2. parameters.xml文件自定义

为msdeploy设置应用程序池的另一篇文章似乎暗示我可以修改生成的parameters.xml文件,以便可以将应用程序池名称指定为msdeploy的参数.该文件位于zip软件包中,因此很难进行自定义.如果我将其更改为存档,则文件更易于访问.

2. A parameters.xml file customization

Another post on setting the app pool for msdeploy seems to imply I might be able to modify the generated parameters.xml file so that I can specify the app pool name as an argument to msdeploy. This file exists within the zip package so wouldn't be easy to customize. If I change it to an archive then the file's more easily accessible.

如何部署Web应用页似乎暗示我可能需要从IIS Express切换到IIS,然后启用一些复选框.在我的项目属性页上,不管包括IIS Express中配置的IIS设置"复选框设置(我目前未选中),都禁用了Include application pool settings used by this Web project复选框.接下来,我将尝试切换到完整的IIS,看看是否能更好地控制我.

The Howto deploy a webapp page seems to imply I might need to switch from IIS Express to IIS and then enable some checkboxes. On my project properties page the Include application pool settings used by this Web project checkbox is disabled regardless of the "Include IIS settings as configured in IIS Express" checkbox setting (which I currently have unchecked). I'll try switching to the full IIS next and seeing if that gives me better control.

看来我可以创建具有单独工具的应用程序池,但我不确定它是否仅TFS.这是我以前从未见过的工具,但它可能是功能强大的工具.

It looks like I might be able to create an app pool with a separate tool but I'm not sure if it's TFS-only. It's a tool that I haven't seen before but it may be a capable tool.

MSDeploy的 appPoolConfig提供程序看起来很有希望因为我可能可以手动设置一个应用程序池,然后将其用作同步源,但是至少只有一次.

MSDeploy's appPoolConfig provider looks promising as I could probably manually setup an application pool and then use that as a sync source, but at least it's only manual once.

我也开始研究如何实现这一目标的可能性.

I'm also starting to look into the possibilities on how to accomplish this.

我还有一些工作要做,但是我可以给你以下几点建议:

I've still some research to do, but I can give you the following pointers:

  1. IncludeAppPool = true启用AppPoolExtension,当将网站从一个位置同步到另一个位置时,它还会复制应用程序池. 我猜它在创建包时不会起作用.除非您通过本地IIS运行WAP且您将IIS设置包含在软件包中,否则可能会出现这种情况.

  1. IncludeAppPool=true enable the AppPoolExtension which also copies the app pool when synching a web site from one location to the other. I guess it will not have an effect when creating a package. Unless maybe if you WAP is run via your local IIS and you include IIS Settings in your package.

Parameters.xml.但是,如果将Parameters.xml文件放在WAP的根目录中,则可以指定自己的参数,打包时将与VS创建的参数合并.

Parameters.xml exists in the zip indeed. But if you place a Parameters.xml file in the root of your WAP you can specify your own parameters which will be merged with the one VS creates when packaging.

您确实可以检查包括此Web项目使用的应用程序池设置"(实际上:这会将msbuild属性IncludeAppPool设置为true).然后,清单将包含一个用于创建应用程序池的条目.但是,仅当您从也在本地运行WAP的计算机上创建软件包时才有可能.在我的情况下使用构建服务器时,这不是一个选择

You can indeed check "Include application pool settings used by this Web project" (in fact: this sets the msbuild property IncludeAppPool to true). The manifest will then hold a entry for creating the app-pool. This is however only possible if you are creating the package from a machine that also locally runs the WAP. This is not an option when working with a build server which is my case

可以使批处理脚本从命令行运行msdeploy,并使用AppPool提供程序创建apppool.尽管这对我来说似乎有些笨拙,因为我想将Apppool创建内容包含在我的VS(或构建服务器)生成的软件包的清单中

It could be possible to make a batch script to run msdeploy from the commandline and use the AppPool provider to create the apppool. Although this seems a bit clunky to me as I'd like to include the apppool creation inside the manifest of my VS (or build server) generated package

我现在正在调查是否有可能使用wpp.targets文件将apppoolconfig提供插入清单中(更多信息此处

I'm right now investigating if it would be possible to insert the apppoolconfig provide inside my manifest using a wpp.targets file (more info here and here

如果我找到了解决方法,我可能会回信给你.

I might get back to you if I find how to do it.

我发现您无法使用appPoolConfig提供程序打包创建新应用程序池的过程.我*写自己的提供者.我是根据发现的一些(非常基本的)示例并通过对一些现有提供程序进行反向工程来实现的.我基本上所做的是创建一个包装类,该包装类调用c:\ windows \ system32 \ inetsrv \ appcmd并将此功能公开为MSDeploy提供程序. appcmd是用于配置iis的命令行工具,您可以使用它来创建apppools ...如果有人感兴趣,我可以共享一些代码...

I've found out that there is no way you can package the creation of a new app pool using the appPoolConfig provider. I was forced to write my own provider. I did that based on some (very basic) examples I found and by reverse engineering some of the existing providers. What I basically did was create a wrapper class that calls c:\windows\system32\inetsrv\appcmd and exposed this functionallity as a MSDeploy provider. appcmd is a commandline tool to configure iis, with it you can create apppools... If anyone's interested I could share some of the code...

另一项修改

很抱歉,我花了这么长时间,但是我已将我的自定义AppPoolConfigProvider的一些代码放在我的skydrive上,您可以访问它此处是要访问它的要点仓库.

I'm sorry it took me so long but I've put some of my code my custom AppPoolConfigProvider on my skydrive you can access it here Or here is a gist repo to access it.

要使用此提供程序,应将已编译的dll放在Extensibility文件夹下(您必须在"c:\ Program Files(x86)\ IIS \ Microsoft Web Deploy V2 \"下自行创建).您可以在线找到有关此信息的更多信息.

To use this provider, should place your compiled dll under an Extensibility folder (you have to create it yourself under "c:\Program Files (x86)\IIS\Microsoft Web Deploy V2\"). You can find more info about this online.

我在xxx.wpp.targets文件中使用提供程序,如下所示:

I use the provider in my xxx.wpp.targets file like this:

<Target Name="AddConfigAppPool" Condition="'$(RunConfigAppPool)'">
<Message Text="Adding configAppPool provider" />
<ItemGroup>
  <MsDeploySourceManifest Include="configAppPool">
    <path>@(__DefaultDeployEnvironmentSetting->'%(AppPoolName)')</path><!-- Represents the name of the AppPool, required-->
    <managedRuntimeVersion>$(DeployManagedRuntimeVersion)</managedRuntimeVersion>
    <managedPipelineMode>$(DeployManagedPipelineMode)</managedPipelineMode>
    <processModel_identityType>@(__DefaultDeployEnvironmentSetting->'%(AppPoolIdentyType)')</processModel_identityType>
    <processModel_userName>@(__DefaultDeployEnvironmentSetting->'%(AppPoolUserName)')</processModel_userName>
    <processModel_password>@(__DefaultDeployEnvironmentSetting->'%(AppPoolUserPassword)')</processModel_password>
    <processModel_idleTimeout>00:00:00</processModel_idleTimeout>
    <AdditionalProviderSettings>managedRuntimeVersion;managedPipelineMode;processModel_identityType;processModel_userName;processModel_password;processModel_idleTimeout</AdditionalProviderSettings>
    <!--Possible additional provider settings: queueLength,autoStart,enable32BitAppOnWin64,managedRuntimeVersion,managedRuntimeLoader,enableConfigurationOverride,managedPipelineMode,CLRConfigFile,passAnonymousToken,startMode,processModel_identityType,processModel_userName,processModel_password,processModel_loadUserProfile,processModel_logonType,processModel_manualGroupMembership,processModel_idleTimeout,processModel_maxProcesses,processModel_shutdownTimeLimit,processModel_startupTimeLimit,processModel_pingingEnabled,processModel_pingInterval,processModel_pingResponseTime,recycling_disallowOverlappingRotation,recycling_disallowRotationOnConfigChange,recycling_logEventOnRecycle,recycling_periodicRestart_memory,recycling_periodicRestart_privateMemory,recycling_periodicRestart_requests,recycling_periodicRestart_time,recycling_periodicRestart_schedule_[value='timespan']_value,failure_loadBalancerCapabilities,failure_orphanWorkerProcess,failure_orphanActionExe,failure_orphanActionParams,failure_rapidFailProtection,failure_rapidFailProtectionInterval,failure_rapidFailProtectionMaxCrashes,failure_autoShutdownExe,failure_autoShutdownParams,cpu_limit,cpu_action,cpu_resetInterval,cpu_smpAffinitized,cpu_smpProcessorAffinityMask,cpu_smpProcessorAffinityMask2-->      
  </MsDeploySourceManifest>    
</ItemGroup>

很抱歉,我无法对此进行详细说明,但是已经有一段时间了,因为我编写了这段代码,而我却没有时间.您可以在线找到一些有关创建自定义提供程序的信息.如果您还有其他问题,请在有时间的时候尝试回答.

I'm sorry I can't eleborate more on this, but it's been a while since I wrote this code and I simply do not have the time. You can find some info online about creating custom providers. If you have additional questions, I'll try to answer when I have time available.

希望这会有所帮助