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

推荐答案

如果你真的没有忘记任何东西(视图、SP等),那么谷歌搜索表示"愚蠢"的解决方案,比如关闭项目、重新打开、重建或:

The thing that actually did the trick was going through the ASP.NET Configuration utility (Visual Studio - under Website menu), taking the application offline and then back online. This actually just makes a change to web.config (not exactly sure what the change was). So after taking it offline, I had to upload web.config to the hosted solution. Then took the application back online, recopied web.config, etc.

也许这就是答案.

Sql相关问答推荐

在SQL中查询SQL以返回NULLS和空数据集的 node 列表

通过 Select 值的顺序进行排序ClickHouse

连接三个表的正确方式是什么?在这三个表中,可以显示在一个表上的行将在其他表中显示结果

如何在PostgreSQL中的一列中添加两个文本?

OVER子句WITH PARTITION BY和ORDER BY忽略主查询的WHERE子句

如何隐藏聚合JSON数组元素的键

为什么我的SQL标量函数有时会抛出";子查询返回多个值.这是不允许的.

在Postgres中合并相似的表

Select 列组(按同一表格中的另一列分组)Laravel 10

了解多个分组集

SQL:如果一个表中的日期在另一个表的日期的12个月内,则为是或否

在Oracle SQL中按月生成日期

Snowflake 中的分层数据

SQL 根据前一天的最大值计算每天的值数

用户定义的标量值函数是否仍然会阻止并行性?

PostgreSQL分割字符串为子词并判断其是否存在于其他字符串中

所有列分组的简写?

将 MERGE 语句与 Oracle PL/SQL 表类型一起使用时,导致无效数据类型错误的原因是什么?

如何对 SQL 表中的连续时间戳进行分组?

T-SQL - 返回每条记录的最近雇佣日期