不支持将 64 位源和 32 位目标与提供程序 appHostConfig 一起使用

Using a 64-bit source and a 32-bit destination with provider appHostConfig is not supported

我正在尝试使用 MSDeploy 进行自动部署,但是一旦我改为使用应用程序池,我收到了以下错误:

Using a 64-bit source and a 32-bit destination with provider appHostConfig is not supported.

部署时我需要指定要使用的应用程序池名称。服务器是 64 位的。

MSBuild

"%SOAB_MSBUILD_EXE%" "%SOAB_LOCAL_APP_PATH%\WebAPI\WebAPI.csproj" /t:Package /p:Configuration=Debug;PublishProfile=CI /p:VisualStudioVersion=16.0 /p:IncludeIisSettings=true /p:IncludeAppPool=true

MSDeploy

CALL "%SOAB_LOCAL_APP_PATH%\WebAPI\obj\Debug\Package\WebAPI.deploy.cmd" /Y "-setParam:'IIS Web Application Name'='Default Web Site\WebAPI'" "-setParam:'IIS Web Application Pool Name'='MyAppPool'"

MSBuild 路径

C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\Bin\amd64\msbuild.exe

包含在 %% 中的任何内容都是在运行时由构建服务器替换的变量。

一切都按预期工作,直到我尝试使用 MSDeploy 更改 ApplicationPool。为了让应用程序池工作,我将以下参数添加到 MSBuild 命令 /p:IncludeIisSettings=true /p:IncludeAppPool=true 并将 setParam name/value 添加到 MSDeploy 命令。我无法使用 DefaultAppPool。对于我做错了什么,任何帮助表示赞赏,在此先感谢您。

编辑:WebAPI.SetParameters.xml 在 obj\debug\package

中声明的参数
<?xml version="1.0" encoding="utf-8"?>
<parameters>
  <setParameter name="IIS Web Application Name" value="Default Web Site/WebAPI_deploy" />
  <setParameter name="IIS Web Application Pool Name" value="DefaultAppPool" />
  <setParameter name="IisVirtualDirectoryPhysicalPath" value="c:\_Files\MyApplication\WebAPI_deploy" />
</parameters>

编辑:详细日志,我认为这不会增加太多价值,但也许它会对在 MSDeploy 方面有更多经验的人有所帮助。

-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='c:\_Files\MyApplication\WebAPI\obj\Debug\Package\WebAPI.zip' -dest:auto,includeAcls="False" -verb:sync -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"c:\_Files\MyApplication\WebAPI\obj\Debug\Package\WebAPI.SetParameters.xml" -setParam:'IIS Web Application Name'='Default Web Site\WebAPI' -setParam:'IIS Web Application Pool Name'='MyAppPool' -verbose
Verbose: Performing synchronization pass #1.
Verbose: Parameter entry 'IIS Web Application Name/1' is applicable to 'appHostConfig/Default Web Site/WebAPI' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/2' is applicable to 'contentPath/c:\_Files\MyApplication\WebAPI\obj\Debug\Package\PackageTmp' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/3' could not be applied anywhere.
Verbose: Parameter entry 'IIS Web Application Name/1' is applicable to 'appHostConfig/Default Web Site/WebAPI' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/2' is applicable to 'contentPath/c:\_Files\MyApplication\WebAPI\obj\Debug\Package\PackageTmp' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/3' could not be applied anywhere.
Verbose: Parameter entry 'IIS Web Application Name/1' is applicable to 'appHostConfig/Default Web Site/WebAPI' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/2' is applicable to 'contentPath/c:\_Files\MyApplication\WebAPI\obj\Debug\Package\PackageTmp' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/3' could not be applied anywhere.
Verbose: No backup was executed.
Verbose: Parameter entry 'IIS Web Application Name/1' is applicable to 'appHostConfig/Default Web Site/WebAPI' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/2' is applicable to 'contentPath/c:\_Files\MyApplication\WebAPI\obj\Debug\Package\PackageTmp' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/3' could not be applied anywhere.
Info: Adding sitemanifest (sitemanifest).
Verbose: Parameter entry 'IIS Web Application Name/1' is applicable to 'appHostConfig/Default Web Site/WebAPI' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/2' is applicable to 'contentPath/c:\_Files\MyApplication\WebAPI\obj\Debug\Package\PackageTmp' because of its scope.
Verbose: Parameter entry 'IIS Web Application Name/3' could not be applied anywhere.
ERROR: Error: Using a 64-bit source and a 32-bit destination with provider appHostConfig is not supported.
ERROR: Error count: 1.

错误说明问题。您必须在源上使用 64-bit 版本,在目标上使用 64-bit 版本。

您正在使用 Microsoft Visual Studio 32-bit 版本。您必须安装 64-bitMicrosoft Visual Studio。然后一切都会正常工作。还要确保您的 Microsoft Web Deploy 也是 64-bit 版本。


替代方法 -: 另一方面,此错误发生是因为 appHostConfig 源和目标之间同步。按照此命令忽略错误。

-skip:attributes.name="AppWarmupModule"

在 MSdeploy -skip:<arg settings> 关键字的主要任务是指定提到的对象在同步期间跳过.

在原来的 post 之前,我尝试卸载 Web Deploy,然后安装 64 位版本。由于某种原因,安装 64 位版本的 Web Deploy 也会安装 32 位版本。我的团队在服务器上安装了多个版本。我终于删除了所有注册表项,并完全删除了与 Web Deploy 相关的所有内容,包括服务。我重新安装了 64 位版本的 Web Deploy(Complete Install with Services),并收到了相同的错误消息。我同时检查了 'Program Files' 和 'Program Files x86',并在两者中都看到了 Web Deploy。我直接从使用 WebAPI.deploy.cmd 切换到 MSDeploy.exe。原因是因为 WebAPI.deploy.cmd 文件仍在使用 32 位版本的 Web 部署。通过改为直接使用 MSDeploy.exe,我能够控制 32 位或 64 位版本。我收到一个新错误,并解决了它。我现在需要的只是插入应用程序池标识的密码。