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

发布于 2024-12-09 03:12:39 字数 1703 浏览 3 评论 0原文

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

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

问题:

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

到目前为止我发现了什么:

1. MSBuild 参数

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

/p:IncludeAppPool=true

2.parameters.xml 文件自定义

另一篇关于为 msdeploy 设置应用程序池的文章< /a> 似乎暗示我可以修改生成的 parameters.xml 文件,以便我可以将应用程序池名称指定为 msdeploy 的参数。该文件存在于 zip 包中,因此不容易自定义。如果我将其更改为存档,则该文件将更容易访问。

3. VS 设置的更改

如何部署 webapp 页面似乎暗示我可能需要从 IIS Express 切换到 IIS,然后启用一些复选框。在我的项目属性页面上,无论“包括 IIS Express 中配置的 IIS 设置”复选框设置如何(我当前未选中该设置),包括此 Web 项目使用的应用程序池设置 复选框均处于禁用状态。接下来我将尝试切换到完整的 IIS,看看这是否能让我更好地控制。

4.使用cscript创建应用程序池

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

5. MSDeploy 有一个 appPoolConfig 提供程序

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

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

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?

What I've found so far:

1. An MSBuild Parameter

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

3. A change of VS settings

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.

4. Create an app pool with cscript

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.

5. MSDeploy has an appPoolConfig Provider

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.

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

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

发布评论

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

评论(2

一江春梦 2024-12-16 03:12:39

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

我还有一些研究要做,但我可以给您以下提示:

  1. IncludeAppPool=true 启用 AppPoolExtension,当将网站从一个位置同步到另一个位置时,它也会复制应用程序池。
    我猜它在创建包时不会有影响。除非您的 WAP 通过本地 IIS 运行,并且您在程序包中包含 IIS 设置。

  2. Parameters.xml 确实存在于 zip 中。但是,如果您将Parameters.xml 文件放在WAP 的根目录中,您可以指定您自己的参数,这些参数将与打包时VS 创建的参数合并。

  3. 您确实可以选中“包含此 Web 项目使用的应用程序池设置”(事实上:这会将 msbuild 属性 IncludeAppPool 设置为 true)。然后,清单将保存用于创建应用程序池的条目。然而,只有当您从本地也运行 WAP 的计算机创建包时,这才有可能。在使用构建服务器时,这不是一个选项,这就是我的情况

  4. 可以制作一个批处理脚本来从命令行运行 msdeploy 并使用 AppPool 提供程序来创建应用程序池。虽然这对我来说似乎有点笨重,因为我想将应用程序池创建包含在我的 VS(或构建服务器)生成的包的清单中

  5. 我现在正在调查是否可以插入应用程序池配置提供在我的清单中使用 wpp.targets 文件(更多信息此处此处

如果我找到了操作方法,我可能会回复您。

编辑:

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

嗨,另一个编辑,

很抱歉花了我这么长时间,但我已经放了一些我的代码我的自定义 AppPoolConfigProvider 在我的 skydrive 上,您可以访问它 此处
或者这里是访问它的要点存储库。

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

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

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

  2. 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.

  3. 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

  4. 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

  5. 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.

Edit:

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

Hi, another edit

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.

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.

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.

Hope this helps

忆梦 2024-12-16 03:12:39

当我从 Visual Studio 2010 sp1 进行 Web 部署时,我按照以下说明创建了 C# WCF 服务:
http://technologyriver.blogspot.fi/2012/02/precessions -check-windows-7.html

我收到错误:
错误 1 ​​Web 部署任务失败。 (您尝试使用的应用程序池将“managedRuntimeVersion”属性设置为“v2.0”。此应用程序需要“v4.0”。) 0 0 WcfService3

由于我没有完整的 IIS,但 IIS Express 我无法去找经理。与先生约会后。谷歌和女士。我盯着自己的脸找到了解决方案。

修复方法是使用明确正确的 Web 服务名称,而不是示例中使用的默认名称。

解决方案:
首先打开IIS Express配置文件
%userprofile%\documents\IISExpress\config\applicationhost.config

检查其中的默认站点,在我的例子中是:

<site name="WebSite1" id="1" serverAutoStart="true">
  <application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
  </application>
  <bindings>
    <binding protocol="http" bindingInformation=":8080:localhost" />
  </bindings>
</site>

确保该站点的应用程序池是正确的,在我的例子中为“Clr4IntegratedAppPool”

在部署阶段,按照链接博客中的说明,使用一些“默认网站/MyApp”作为站点/应用程序。

对我来说,正确的设置(如站点配置中所示)将是“WebSite1”,并且部署中的服务 url 需要端口绑定,在我的情况下将是“localhost:8080”

如果您觉得需要更多定义,请创建一个全新的站点,在配置中拥有自己的池,并在部署中使用它。
可以在这里找到该方向的一些示例:
http://www.philliphaydon.com/2012/ 06/multiple-iisexpress-sites-profiled-with-dottrace/

希望这可以帮助你们避免与搜索机的令人沮丧的约会。

此致,
佩特里·库贾拉

Trouble found me when I was web deploying from Visual Studio 2010 sp1 the c# WCF service I was creating as instructed in:
http://technologyriver.blogspot.fi/2012/02/prerequisites-check-windows-7.html

I got the error:
Error 1 Web deployment task failed. (The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.) 0 0 WcfService3

As I do not have full IIS but the IIS Express I cannot go to the manager. After some dates with mr. Google and ms. Bing I found the solution, staring at my face.

The fix is to use the explicitly correct web service name instead of the default used in the example.

Solution:
First open the IIS Express config file
%userprofile%\documents\IISExpress\config\applicationhost.config

Check the default site that you have in there, in my case it was:

<site name="WebSite1" id="1" serverAutoStart="true">
  <application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
  </application>
  <bindings>
    <binding protocol="http" bindingInformation=":8080:localhost" />
  </bindings>
</site>

Ensure that the application pool for the site is correct, in my case "Clr4IntegratedAppPool"

In the deployment phase, as instructed in the linked blog, there is used as Site/application some "Default Web Site/MyApp".

For me the correct setting, as seen in the site config, would be "WebSite1" and also the service url in the deployment needs port binding and would be in my case "localhost:8080"

If you feel that you want more definition, create a completely new site with its own pool in the config and use that in the deployment.
Some examples to that direction can be found here:
http://www.philliphaydon.com/2012/06/multiple-iisexpress-sites-profiled-with-dottrace/

Hope this helps any of you avoiding the frustrating dates with search machines.

Best regards,
Petteri Kujala

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