VHanded
VHanded

Reputation: 2089

Migrating ASP.Net Membership

I am facing problem while copying my ASP.Net Membership tables. Since I just want the schema, so I generated script without copying data.

When I access the new site, it shown

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.

Here is the step by step I had done, which I can't get it works.

  1. From source server's SSMS, right click on database.
  2. Task -> Generate Scripts
  3. In Choose Script Option, I clicked Next.
  4. In Choose Object Type, I selected all, and click next.
  5. In Choose Database Role, I selected all.
  6. In Choose Schema, I selected all.
  7. In Choose Stored Procedures, Choose Title, all selected.
  8. Choose All View.
  9. Script to new query window.
  10. In destination server's SSMS, I run the scripts.
  11. Tables created, which are empty.
  12. I ran aspnet_regsql.exe, and the aspnet_SchemaVersions are populated.

However, the error still occur... I had run out of ideas.

Upvotes: 0

Views: 605

Answers (1)

Richard Forrest
Richard Forrest

Reputation: 3615

You need some data in the aspnet_SchemaVersion table. Have a look at the information in the table of the database you are using and add an insert to the end of your script to add that data to the aspnet_SchemaVersion table. I cant remember of the top of my head what's in there but its fairly simple stuff.

Here you go this should probably do it i dont think the version numbers have changed but you should check your existing db.

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘common’, 1, 1) 

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘health monitoring’, 1, 1) 

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘membership’, 1, 1) 

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘personalization’, 1, 1) 

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘profile’, 1, 1) 

INSERT INTO aspnet_SchemaVersions (Feature, CompatibleSchemaVersion, IsCurrentVersion)
VALUES(‘role manager’, 1, 1)

Upvotes: 2

Related Questions