【问题标题】:Error when exporting bacpac using DacServices使用 DacServices 导出 bacpac 时出错
【发布时间】:2018-04-11 09:53:14
【问题描述】:

我正在尝试使用代码导出 bacpac,但出现错误提示

Microsoft.SqlServer.Dac.DacServicesException: '数据库源不是 SQL Server tcp:xxxxxxx.database.windows.net,1433: test 的支持版本。'

我可以毫无问题地使用 SSMS(导出数据层应用程序)导出它。

我的测试程序是 C# .NET 4,已导入 Microsoft.SqlServer.Dac-x86 nuget。

示例代码:

var azureServices = new DacServices($"Data Source={source},1433;Initial Catalog=test;Integrated Security=False;User ID={user};Password={password}");
azureServices.Message += AzureServices_Message;
azureServices.ProgressChanged += AzureServices_ProgressChanged;
azureServices.ExportBacpac(Environment.CurrentDirectory + "test" + DateTime.Now.ToShortTimeString(), "test");

我做错了什么?还是微软破坏了 Azure sql 中的某些内容?

编辑:我需要在本地下载 bacpac,这就是为什么我不使用 rest api 导出到 blob 存储。

【问题讨论】:

    标签: c# azure-sql-database


    【解决方案1】:

    请考虑改用 REST API:

    样品请求:

    POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb/export?api-version=2014-04-01
    

    请求正文:

    {
      "storageKeyType": "StorageAccessKey",
      "storageKey": "sdlfkjdsf+sdlfkjsdlkfsjdfLDKFJSDLKFDFKLjsdfksjdflsdkfD2342309432849328479324/3RSD==",
      "storageUri": "https://test.blob.core.windows.net/bacpacs/testbacpac.bacpac",
      "administratorLogin": "dummyLogin",
      "administratorLoginPassword": "Un53cuRE!",
      "authenticationType": "SQL"
    }
    

    更多信息,请阅读this文档。

    【讨论】:

    • 我需要在本地下载 bacpac,所以这也需要一个“下载步骤”。
    猜你喜欢
    • 2019-06-07
    • 1970-01-01
    • 2016-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-21
    相关资源
    最近更新 更多