Sql server 为什么使用dbDacFx提供程序的MSDeploy命令会抛出无效的XML错误?

Sql server 为什么使用dbDacFx提供程序的MSDeploy命令会抛出无效的XML错误?,sql-server,iis,webdeploy,Sql Server,Iis,Webdeploy,这是我的命令行: C:\mydir>msdeploy.exe -verb:sync -Source:dbDacFx="C:\mydir\my.data.dacpac" -dest:dbDacFx="Data Source=myserver;Database=my.data;user id=sa;password=secret",wmsvc="https://www.mysite.co.nz",username=myuser,password=anothersecret -verbose

这是我的命令行:

C:\mydir>msdeploy.exe -verb:sync -Source:dbDacFx="C:\mydir\my.data.dacpac" -dest:dbDacFx="Data Source=myserver;Database=my.data;user id=sa;password=secret",wmsvc="https://www.mysite.co.nz",username=myuser,password=anothersecret -verbose
以下是输出:

Info: Using ID 'fad3c5de-98e8-413e-a21f-f3c86038790e' for connections to the remote server.
Verbose: Pre-authenticating to remote agent URL 'https://www.mysite.co.nz:8172/msdeploy.axd' as 'myuser'.
Verbose: Performing synchronization pass #1.
Verbose: Pre-authenticating to remote agent URL 'https://www.mysite.co.nz:8172/msdeploy.axd' as 'myuser'.
Verbose: No backup was executed.
Verbose: Received response from agent (HTTP status 'OK').
Info: Adding MSDeploy.dbDacFx (MSDeploy.dbDacFx).
Verbose: The dependency check 'DependencyCheckInUse' found no issues.
Verbose: The current synchronization pass is missing stream content for 1 objects.
Info: Using ID 'f1cb17ef-04f0-43f3-9759-e7ba58fba703' for connections to the remote server.
Verbose: Performing synchronization pass #2.
Verbose: Pre-authenticating to remote agent URL 'https://www.mysite.co.nz:8172/msdeploy.axd' as 'myuser'.
Info: Adding MSDeploy.dbDacFx (MSDeploy.dbDacFx).
Info: Adding database (data source=myserver;database=my.data;user id=sa)
Verbose: Waiting 120 seconds for the DACFx process to complete.
Verbose: The HTTP connection (ID='f1cb17ef-04f0-43f3-9759-e7ba58fba703', type ='GetTraceStatus') is being kept alive while the request is processed.
Verbose: The HTTP connection (ID='f1cb17ef-04f0-43f3-9759-e7ba58fba703', type ='GetTraceStatus') is being kept alive while the request is processed.
Verbose: Received response from agent (HTTP status 'OK').
Error Code: ERROR_CANNOT_PROCESS_DACPAC_OUTPUT
More Information: The output received from executing dacpac in a seperate process was not valid xml.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CANNOT_PROCESS_DACPAC_OUTPUT.
Error: Data at the root level is invalid. Line 20, position 10.
Error count: 1.
我花了很长时间才明白这一点,我不得不求助于在整个命令中嵌入用户名和密码,而不是使用NTLM身份验证。现在有些东西得到了一些无效的XML,我不知道从这里该怎么办


我正在尝试从TeamCity自动部署数据库更改。我们管理所有的服务器,sqlpackage.exe更容易下注吗?

我遇到了这个问题,结果是权限问题

用户只有db_datareader、db_datawriter和execute


我需要给SSDT用户db_owner,然后我就能够克服这个错误。

好的,我已经确认,一旦我从dacpac中删除SqlCmd变量,它就开始给我有意义的响应。我怀疑@GrayPockets看到了和我一样的行为,只是出于不同的原因

我已经成功地部署了dacpac,但立即遇到了另一个障碍,因为我们无法使用MSDeploy为dbDacFx提供程序指定诸如BlockOnPossibleDataLoss之类的选项


所以,从技术上来说,我想我已经回答了我的问题,但我仍然打算放弃MSDeploy,直到微软清理掉这些半实现的工具。

啊,很有意思,谢谢。下一次我在做这个的时候,我会试试这个,然后带着更新回来。我怀疑在我的例子中,它与缺少的SqlCmd变量有关。似乎有东西处理错误了错误消息,并报告了一个不明确的XML解析错误。我发布了一些MS Connect反馈:一旦我们解决了部署管道中的问题,我将更新此问题。