0

我正在将现有的 asp.net mvc 应用程序迁移到 Azure,并希望使用 System.Web.Providers 作为成员资格。

是否有任何现有的工具或方法可以将数据从 ASP.Net 成员资格提供程序迁移到 System.Web.Providers?

4

1 回答 1

3

.NET Web 开发和工具博客上有一篇文章
http://blogs.msdn.com/b/webdev/archive/2012/08/16/migration-for-user-accounts-from-the-sqlmembershipprovider-to- the-universal-providers.aspx
详细解释了如何移动数据以及要触摸的 Web.Config 属性。

基本上你需要的是一堆 SQL 语句

INSERT INTO dbo.Applications (ApplicationName, ApplicationId, Description)
SELECT ApplicationName, ApplicationId, Description FROM dbo.aspnet_Applications
GO

INSERT INTO dbo.Roles (ApplicationId, RoleId, RoleName, Description)
SELECT ApplicationId, RoleId, RoleName, Description FROM dbo.aspnet_Roles
GO

INSERT INTO dbo.Users (ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate)
SELECT ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate FROM dbo.aspnet_Users
GO

INSERT INTO dbo.Memberships (ApplicationId, UserId, Password, 

PasswordFormat, PasswordSalt, Email, PasswordQuestion, PasswordAnswer, 

IsApproved, IsLockedOut, CreateDate, LastLoginDate, LastPasswordChangedDate, 

LastLockoutDate, FailedPasswordAttemptCount, 

FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount, 

FailedPasswordAnswerAttemptWindowStart, Comment) 
SELECT ApplicationId, UserId, Password, 

PasswordFormat, PasswordSalt, Email, PasswordQuestion, PasswordAnswer, 

IsApproved, IsLockedOut, CreateDate, LastLoginDate, LastPasswordChangedDate, 

LastLockoutDate, FailedPasswordAttemptCount, 

FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount, 

FailedPasswordAnswerAttemptWindowStart, Comment FROM dbo.aspnet_Membership
GO

INSERT INTO dbo.UsersInRoles SELECT * FROM dbo.aspnet_UsersInRoles
GO

您还必须passwordCompatMode="Framework20"向会员提供者配置添加属性。

于 2012-10-22T07:31:40.400 回答