CAQuietExec:无法连接到目标服务器:Wix 安装程序

CAQuietExec: Unable to connect to target server: Wix Installer

安装程序在客户端机器上尝试 运行 时失败。安装程序是用 Wix 和 C# 制作的。通过查看日志;我有几行错误。

MSI (s) (F4:A4) [01:52:37:027]: Executing op: CustomActionSchedule(Action=sqlcmd,ActionType=1025,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\Program Files (x86)\Microsoft SQL Server0\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:"C:\Program Files (x86)\<directory>\XYZ_Create.dacpac" /TargetConnectionString:"Data Source=ServerName;Initial Catalog=XYZ;Integrated Security=True")
MSI (s) (F4:C4) [01:52:37:027]: Invoking remote custom action. DLL: C:\windows\Installer\MSI1CAA.tmp, Entrypoint: CAQuietExec
CAQuietExec:  Entering CAQuietExec in C:\windows\Installer\MSI1CAA.tmp, version 3.10.2516.0
CAQuietExec:  "C:\Program Files (x86)\Microsoft SQL Server0\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:"C:\Program Files (x86)\<directory>\XYZ_Create.dacpac" /TargetConnectionString:"Data Source=ServerName;Initial Catalog=PsrX;Integrated Security=True"
CAQuietExec:  Publishing to database 'PsrX' on server 'ServerName'.
CAQuietExec:  Initializing deployment (Start)
CAQuietExec:  Initializing deployment (Failed)
CAQuietExec:  *** Could not deploy package.
CAQuietExec:  Unable to connect to target server.
CAQuietExec:  Error 0x80070001: Command line returned an error.
CAQuietExec:  Error 0x80070001: QuietExec Failed
CAQuietExec:  Error 0x80070001: Failed in ExecCommon method

CAQuietExec 提到的 Wix 代码是:

```Wix  Code   
<CustomAction Id="sqlcmd"
                      BinaryKey="WixCA"
                      DllEntry="CAQuietExec"
                      Return="check"
                      Execute="deferred"
                      Impersonate="yes" />
```

客户正在使用 SQL Server 2016。

我尝试了网上的一些解决方案: https://blogs.msdn.microsoft.com/sqlserverfaq/2016/10/12/error-could-not-deploy-package-unable-to-connect-to-target-server/(我将 DAC 文件夹从 120 复制到 130 并尝试但仍然没有运气)。

我已经与客户核实过登录用户是否有任何access/privilege问题,但他们拒绝了。

此安装程序正在为其他几个客户端工作。

有人可以帮我吗?谢谢!

CAQuietExec 只是从您正在调用的 EXE 中记录标准输出和标准错误。 SQLPackage.exe 无法连接到目标服务器而不是 WiX / CAQuetExec。

https://blogs.msdn.microsoft.com/sqlserverfaq/2016/10/12/error-could-not-deploy-package-unable-to-connect-to-target-server/

https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/09/19/deployment-fails-with-unable-to-connect-to-master-or-target-server-mydb_svr-you-must-have-a-user-with-the-same-password-in-master-or-target-server-mydb-db/

如上所述,此客户端正在 SQL Server 2016 上工作。

在 CustomAction 中它试图从 property.wxs

获取所有可用的 sql 服务器
-- CustomAction Code
string[] sqlVersions = session["SQLVERSIONS"].Split(';');


-- Property.wxs
  <Property Id="SQLVERSIONS" Secure="yes" Value="140,130;120;110;100;90"></Property>

这里没有140。因此,它无法找到 140 DAC 文件夹,因此失败并出现错误。 它正在尝试与此客户端不兼容的 120 文件夹结构。