Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

asp.net - The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'

I have a SQL Server 2008 DB with many tables filled with data and I used SQL Server Management Studio to generate a SQL dump by using the Script Wizard : Tasks -> Generate Scripts -> Script All objects in the selected database and also selecting the option to Script Data. I made sure to change the value of "Script for Server Version" to "SQL Server 2008". Then I created a new DB and ran the SQL dump on the new DB to generate an identical copy of the old DB. Then I assigned permissions to my default user to the new DB. Then I changed the connection string on my ASP.NET application to use the new DB. But when I run it, it throws the following exception -

            Server Error in '/myapp' Application.
            The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.
            Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

            Exception Details: System.Configuration.Provider.ProviderException: The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

            Source Error:

            An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

            Stack Trace:

            [ProviderException: The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.]
               System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +1977772
               System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +89
               System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +815
               System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
               System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
               System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +78
               System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
               System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119
               System.Web.UI.WebControls.Login.AttemptLogin() +115
               System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
               System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
               System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
               System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
               System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
               System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
               System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
               System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have found a very simple way, just paste this data in the aspnet_SchemaVersions table

common              1   True
health monitoring   1   True
membership          1   True
personalization     1   True
profile             1   True
role manager        1   True

I had to use a few spaces to make the data aligned, ignore the blank spaces


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...