我正在将现有的asp.net mvc应用程序迁移到Azure,并希望使用System.Web.Providers作为成员资格。
是否有任何现有的工具或配方可以将数据从ASP.Net成员资格提供程序迁移到System.Web.Providers?
答案 0 :(得分: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"
属性添加到成员资格提供程序配置中。