DACPAC无法部署是因为“无法连接到服务器"吗? [英] DACPAC won't deploy because 'can't connect to server'?

查看:107
本文介绍了DACPAC无法部署是因为“无法连接到服务器"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将DACPAC部署到LocalDB 2012,但是它没有它:

I'm trying to deploy a DACPAC to LocalDB 2012 but it's just not having it:

堆栈跟踪如下:

==================================

Could not deploy package. (Microsoft.SqlServer.Dac)

------------------------------
Program Location:

   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, Action`2 reportStatus, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable`1 cancellationToken)
   at Microsoft.SqlServer.Management.Dac.DacWizard.DeployModel.Install()
   at Microsoft.SqlServer.Management.Dac.DacWizard.DeployModel.RunAction()
   at Microsoft.SqlServer.Management.Dac.DacWizard.ExecuteDacPage.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

===================================

Unable to connect to target server. (Microsoft.Data.Tools.Schema.Sql)

------------------------------
Program Location:

   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentEndpointServer.OnInit(ErrorManager errors, String targetDBName)
   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment..ctor(SqlDeploymentConstructor constructor)
   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentConstructor.ConstructServiceImplementation()
   at Microsoft.SqlServer.Dac.DacServices.CreatePackageToDatabaseDeployment(String connectionString, IPackageSource packageSource, String targetDatabaseName, DacDeployOptions options, ErrorManager errorManager)
   at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass4.<CreatePlanInitializationOperation>b__0(Object operation, CancellationToken token)
   at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)

现在,由于我正尝试通过SSMS进行部署,因此我知道可以连接到服务器了.我已经在Visual Studio中检查了解决方案,并且目标版本适用于SQL Server 2012,并且连接字符串似乎正确.

Now since I'm attempting to deploy this through SSMS, I know I can connect to the server. I've checked the solution in Visual Studio and the target version is for SQL Server 2012 and the connection string appears to be correct.

有趣的是,通过Visual Studio进行部署是可行的,但是后来我无法将数据库升级到数据层应用程序,我收到此消息:

Interestingly, doing a deploy through Visual Studio works, but then I can't upgrade the database to a data tier application, I get this message:

===================================

Database source is not a supported version of SQL Server (localdb)\MYINSTANCE: . (Microsoft.SqlServer.Dac)
------------------------------
Program Location:

   at Microsoft.SqlServer.Dac.DacServices.GetDatabaseSchemaProvider(String connectionString)
   at Microsoft.SqlServer.Dac.DacServices.InternalRegister(String targetDatabaseName, String applicationName, Version applicationVersion, String applicationDescription, ModelStorageType modelStorageType)
   at Microsoft.SqlServer.Dac.DacServices.<>c__DisplayClass29.<Register>b__28(Object operation, CancellationToken token)
   at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, Action`2 reportStatus, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.Register(String targetDatabaseName, DacSchemaModelStorageType modelStorageType, String applicationName, Version applicationVersion, String applicationDescription)
   at Microsoft.SqlServer.Management.Dac.DacWizard.RegisterModel.RunAction()
   at Microsoft.SqlServer.Management.Dac.DacWizard.ExecuteDacPage.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

我想念什么?

推荐答案

更新到最新版本的SSMS应该可以解决此问题.在此处可用: https://msdn.microsoft.com/zh-cn/library /mt238290.aspx

Updating to the latest version of SSMS should fix this. It's available here: https://msdn.microsoft.com/en-us/library/mt238290.aspx

否则,请确认您使用的LocalDB版本是LocalDB2012.为此,您可以在服务器上运行以下查询:

Otherwise, please confirm that the version of LocalDB you're using is LocalDB 2012. To do this you can run this query against the server:

select @@version

  • 11.0.xxxx = SQL Server 2012
  • 12.0.xxxx = SQL Server 2014
  • 13.0.xxxx = SQL Server 2016
  • 处理dacpac部署的库称为数据层应用程序框架或DacFX. SSMS 2012使用的DacFX版本安装在:

    The library that handles dacpac deployment is called the data-tier application framework, or DacFX. The version of DacFX used by SSMS 2012 is installed in:

    C:\program files (x86)\Microsoft Sql Server\110\DAC\bin
    

    请注意路径中的"110",表示DacFX的版本最多支持SQL Server2012.SSMS2014在相似的路径中查找DacFX,但在120文件夹中,并且DacFX的版本最多支持SQL. Server 2014,依此类推.

    Note the "110" in the path, indicating that the version of DacFX supports up to SQL Server 2012. SSMS 2014 looks for DacFX in a similar path, but in the 120 folder, and that version of DacFX supports up to SQL Server 2014, and so on.

    当要求DacFX部署到比支持的版本新的服务器版本时,它将显示无法连接"错误消息. (顺便说一下,错误消息已在较新版本的DacFX中得到了改进.)

    When DacFX is asked to deploy to a server version that's newer than what is supports, it will give the "Cannot connect" error message. (The error message has been improved in newer versions of DacFX, by the way).

    在某个时间点,Visual Studio使用了上述路径中安装的DacFX版本,但是在SQL Server工具中发布SQL Server 2014支持的那一刻,进行了更改,Visual Studio获得了自己的副本DacFX的

    At one point in time, Visual Studio used the version of DacFX installed in the above path, but around the time that SQL Server 2014 support was released in the SQL Server tools, a change was made and Visual Studio got its own copy of DacFX under

    C:\program files (x86)\Microsoft Visual Studio XX.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120
    

    因此,这就是您如何在不同版本的Visual Studio和SSMS之间获得不同的行为.

    So this is how you can get different behavior between different versions of Visual Studio and SSMS.

    这篇关于DACPAC无法部署是因为“无法连接到服务器"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆