将 SQL 服务器 CE 迁移到 Azure

Migrate SQL Server CE to Azure

我已经完成了我的第一个完整的 Orchard CMS 网站,它是在 SQL Server CE 本地开发的。我想将它发布到 Azure,但我在使用 WebMatrix Migrate 功能时遇到问题。

我在 Azure 中有一个 SQL 服务器实例,其中已经有一个空白的 Orchard 数据库(我想在迁移后期使用替换选项来删除现有的数据库)。我已将我的 IP 添加到服务器防火墙规则中。

在 WebMatrix 3 中,我可以使用以下方式连接到我的 Azure 数据库:

我可以在 WebMatrix 中查看表格。

当我 select 我的 CE sdf 文件 (Orchard.sdf) 并单击迁移按钮并输入完全相同的详细信息时,我得到以下信息(如果需要可以提供完整的堆栈跟踪):

We were unable to connect using the connection details provided.

Microsoft.SqlServer.Management.Common.ConnectionFailureException: Failed to connect to server . ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception: The network path was not found

我真的不确定是什么问题。我尝试了各种细节配置,但似乎没有任何效果。如果我以我的数据库用户(即不是服务器管理员)的身份连接,我会得到一个不同的错误:

The server principal "orchard_user" is not able to access the database "master" under the current security context.

我去吃了点东西,现在可以进入下一步的迁移了。当我 select 替换数据库时,出现以下错误:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.SqlServer.Management.Common.ConnectionFailureException: Failed to connect to server . ---> System.Data.SqlClient.SqlException: Login failed for user 'admin'.

编辑:我得出的结论是 WebMatrix 不会将我的 SQL 服务器 CE 数据库迁移到我的 Azure SQL 服务器数据库。我安装了 SQL Server Express 并将其迁移到那个,当我下班回家后,我将使用 SQL Server Migration Assistant 将其迁移到 Azure。

我最终安装了 SQL Server Express,使用 WebMatrix 将 SQL Server CE 数据库迁移到那个。然后我 运行 SSMS 中的将数据库部署到 Microsoft Azure 数据库向导将我的数据库推送到 Azure。

我不能确定,但​​ WebMatrix 似乎无法将 CE 迁移到 Azure。根据 Azure doco:

It is recommended that you always use the latest version of Management Studio to remain synchronized with updates to Microsoft Azure and SQL Database. Update SQL Server Management Studio.

我猜 WebMatrix 落后了。希望这对我的情况有所帮助。