I have an MSBuild script that is generating a deployment script for my web app.
我有一个MSBuild脚本,它正在为我的web应用生成一个部署脚本。
Project.build (excerpt)
<MSBuild Projects="xxxxx.sln" Properties="
CreatePackageOnPublish=true;
DeployOnBuild=true;
IncludeIisSettings=true;
IncludeAppPool=true;" >
<Output TaskParameter="TargetOutputs" ItemName="CompiledAssembly" />
</MSBuild>
When this is executed, it does produce a Package
folder in the output that contains a deployment .cmd
file and associated .zip
file.
当执行此操作时,它会在输出中生成一个包文件夹,其中包含部署.cmd文件和相关的.zip文件。
xxxx.SetParameters.xml (generated)
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site\xxxxx" />
<setParameter name="DefaultConnection-Web.config Connection String"
value=" ... snipped ..." />
</parameters>
As you can see, there is no reference to app pool here. Likewise, there is mention of app pool in the generated xxxx.zip\parameters.xml
如您所见,这里没有对应用程序池的引用。同样,在生成的xxxxx .zip\parameters.xml中也提到了应用程序池
When I execute xxxxxx.deploy.cmd /Y
, it correctly creates the application in IIS. The problem is, it seems to use the default application pool for the machine. It's a .net 4 app, so if the default is .net 2, the app fails to run.
当我执行xxxxxxx .deploy.cmd /Y时,它会在IIS中正确地创建应用程序。问题是,它似乎使用了机器的默认应用程序池。这是一个。net 4应用,所以如果默认是。net 2,应用程序就不能运行。
Is there a way to make the deployment script include an app pool definition so that it won't require manual app pool changes to run?
有没有一种方法可以让部署脚本包含一个应用程序池定义,这样它就不需要手动修改应用程序池来运行了?
I did find this question, which seems to be the same. However, as you can see, I've already included the answer from that question, and it has no effect.
我确实发现了这个问题,似乎是一样的。但是,正如您所看到的,我已经包含了这个问题的答案,它没有任何影响。
1 个解决方案
#1
3
If you're trying to deploy a 4.0 app to a 2.0 default app pool without providing an override it will not fail to run but fail to deploy, MSDeploy would simply fail to precreate a virtual app with ERROR_APPPOOL_VERSION_MISMATCH
error.
如果您试图将4.0应用程序部署到2.0的默认应用程序池中,而不提供覆盖,它将不会失败,但部署失败,MSDeploy将无法使用error_apppool_version_错配错误预创建一个虚拟应用程序。
IncludeAppPool
is the correct property, but it only tells the packager to include the settings, you have to provide the source, i.e. the "master" virtual app with correct app pool to copy from.
IncludeAppPool是正确的属性,但它只告诉包装器要包含设置,你必须提供源,即“master”虚拟应用,拥有正确的应用程序池。
Open project properties and switch from IIS Express
to Local IIS
, this will enable app pool flag under the package/publish options. I believe you can switch back afterwards, the settings will remain.
打开项目属性并从IIS Express切换到本地IIS,这将在package/publish选项下启用应用程序池标志。我相信你以后可以转回去,设置会保留。
This would basically do 2 things, add <IncludeAppPool>true</IncludeAppPool>
as well as add the master app under <WebProjectProperties>
section. Now when you build or package your source manifest will not have the managedRuntimeVersion
requirement but your parameters will now have IIS Web Application Pool Name
to customize.
这基本上可以做两件事,添加
If you want to actually create a new app pool then it gets tricky. I'm not aware of a way to create it during iisApp
creation or with some MSBuild flag, but with MSDeploy (the tool behind your .cmd
) it would require a dump of your local pool and sync up with appPoolConfig
provider, probably as part of your .build
script before the .cmd
call.
如果你真的想要创建一个新的应用程序池,那就有点麻烦了。我不知道一个方法创建它在iisApp创建或一些MSBuild国旗,但随着MSDeploy(.cmd)背后的工具需要转储你当地的游泳池和同步appPoolConfig提供者,可能作为.build脚本的一部分.cmd之前调用。
msdeploy -verb:sync -source:appPoolConfig=Foo -dest:package=foo.zip
msdeploy -verb:sync -source:package=foo.zip -dest:appPoolConfig=Foo,computerName=Bar
Keep in mind that without specifying individual appPoolConfig the sync, as it should, would destroy other pools, so do -whatIf
first just in case.
请记住,在不指定单独的appPoolConfig的情况下,同步会破坏其他的池,所以-whatIf首先要做的是以防万一。
You can probably try to merge the archive.xml
of your package and the archive.xml
with the app pool definition, but I can't image how it would work and what relationship between iisApp
and appPoolConfig
providers is there.
您可以尝试合并归档文件。您的包和归档的xml。有应用程序池定义的xml,但是我无法想象iisApp和appPoolConfig提供程序之间的关系。
Edit: You can use manifest
provider to combine package
or iisApp
with appPoolConfig
编辑:您可以使用manifest提供程序将包或iisApp与appPoolConfig结合
#1
3
If you're trying to deploy a 4.0 app to a 2.0 default app pool without providing an override it will not fail to run but fail to deploy, MSDeploy would simply fail to precreate a virtual app with ERROR_APPPOOL_VERSION_MISMATCH
error.
如果您试图将4.0应用程序部署到2.0的默认应用程序池中,而不提供覆盖,它将不会失败,但部署失败,MSDeploy将无法使用error_apppool_version_错配错误预创建一个虚拟应用程序。
IncludeAppPool
is the correct property, but it only tells the packager to include the settings, you have to provide the source, i.e. the "master" virtual app with correct app pool to copy from.
IncludeAppPool是正确的属性,但它只告诉包装器要包含设置,你必须提供源,即“master”虚拟应用,拥有正确的应用程序池。
Open project properties and switch from IIS Express
to Local IIS
, this will enable app pool flag under the package/publish options. I believe you can switch back afterwards, the settings will remain.
打开项目属性并从IIS Express切换到本地IIS,这将在package/publish选项下启用应用程序池标志。我相信你以后可以转回去,设置会保留。
This would basically do 2 things, add <IncludeAppPool>true</IncludeAppPool>
as well as add the master app under <WebProjectProperties>
section. Now when you build or package your source manifest will not have the managedRuntimeVersion
requirement but your parameters will now have IIS Web Application Pool Name
to customize.
这基本上可以做两件事,添加
If you want to actually create a new app pool then it gets tricky. I'm not aware of a way to create it during iisApp
creation or with some MSBuild flag, but with MSDeploy (the tool behind your .cmd
) it would require a dump of your local pool and sync up with appPoolConfig
provider, probably as part of your .build
script before the .cmd
call.
如果你真的想要创建一个新的应用程序池,那就有点麻烦了。我不知道一个方法创建它在iisApp创建或一些MSBuild国旗,但随着MSDeploy(.cmd)背后的工具需要转储你当地的游泳池和同步appPoolConfig提供者,可能作为.build脚本的一部分.cmd之前调用。
msdeploy -verb:sync -source:appPoolConfig=Foo -dest:package=foo.zip
msdeploy -verb:sync -source:package=foo.zip -dest:appPoolConfig=Foo,computerName=Bar
Keep in mind that without specifying individual appPoolConfig the sync, as it should, would destroy other pools, so do -whatIf
first just in case.
请记住,在不指定单独的appPoolConfig的情况下,同步会破坏其他的池,所以-whatIf首先要做的是以防万一。
You can probably try to merge the archive.xml
of your package and the archive.xml
with the app pool definition, but I can't image how it would work and what relationship between iisApp
and appPoolConfig
providers is there.
您可以尝试合并归档文件。您的包和归档的xml。有应用程序池定义的xml,但是我无法想象iisApp和appPoolConfig提供程序之间的关系。
Edit: You can use manifest
provider to combine package
or iisApp
with appPoolConfig
编辑:您可以使用manifest提供程序将包或iisApp与appPoolConfig结合