Migrating asp.net membership to Windows Azure

2019-04-02 06:26发布

问题:

I am migrating my asp.net mvc-3 project to windows azure. I have to migrate asp.net membership to windows azure. I read this article. From this artical what i understand is the following points to migrate membership :

1) Migrating membership means just changing the data store where user related information is stored. Means in my case i am using SQL server express 2008 as an on-premises data store. And i just have to chnage it to SQL azure data center.

2) I downloaded ASP.NET Universal provider through Nuget. This will automatically extend the membership support to SQL azure. Means i just have to change the connection string in the web.config file.In that connection string it requires server-name and database. For this i have to create an account in the windows azure. Where i can create the database. And from there i can get the ready made connection string which i have to just paste in my web.config file.

And i want to know the next steps after doing all this.

I Just want to know whether i am on the correct direction or not. If is there anything i am missing or i am not on the right path then please guide to the correct direction ? Thanks

回答1:

In addition to the Sandrino's answer, I wil just add a suggestion to use the SQL Azure Migration Wizard, as it is much better than the ingrated in SSMS functionality. Just a simple exmaple is that SQL Azure Migration Wizard will automatically create Clustered Indexes for tables which do not have such. Another thing is that the Migration wizard will give you detailed explanation for any non SQL Azure compatible definition/data/statement, while the itegrated "Generate Scripts" will just throw "it is not compatible"..



回答2:

using the ASP.NET Universal Provider is the way to go. For the migration part, I suggest you simply use the generate script functionality of SQL Server (right click your database, choose Tasks, choose Generate Scripts).

In the export wizard you can choose to export to SQL Azure and that the script should include the schema and the data. This will make it very easy for you to move your current on-premises database to SQL Azure.



回答3:

First off, if it works @astaykov's suggesting of SQL Azure Migration Wizard should be your first step. It will tell you what parts of your database are not compatible with SQL Azure. SSMS will generate an insert statement for each row that needs to be migrated. The Migration Wizard will use BCP which is way more efficient.

I had to migrate a Membership database for a client about a year ago. The problem that I ran into was that no automatic migration would work since the database generated by aspnet_regsql.exe contained elements that were not compatible with SQL Azure. There is a new version aspnet_regsqlazure.exe which creates tables with the same schema, but the supporting stored procedures are SQL Azure compatible. Once the matching schema is created, you can move the table contents by whatever means you like SSMS, Migration Wizard, or BCP.

Again, make sure to try astaykov's suggestion first. If the membership database generated has changed recently, it will be much easier that what I had to do.