Monday, February 4, 2013

The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'. Solved...

While working with Asp.NET and Membership, using MS SQL 2008 R2 I came across following error. My web application was working perfect on my local machine but when I hosted it on remote server I got following error.
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.
After R&D I had came across three possible solutions "WHICH I THINK ARE RIGHT, AS THEY WORKED FOR ME IN DIFFERENT SCENARIOS."

  1. Check "aspnet_SchemaVersions" table in database and make sure CompatibleSchemaVersion is set to "1" for all the Features (e.g. common, membership, role manager etc) available in table. Also make sure IsCurrentVersion column values are set to 'True" for all Features.
  2. In Web.Config, and aspnet_Applications table check if application Name is matching or not. Application name in web.config's Membership>Providers, Profile>Providers, RoleManager>Providers are matching with application name in database.
  3. In Membership>Provider I had "AspNetSqlMembershipProvider" type as type="System.Web.Security.SqlMembershipProvider" which I modified (after referring to some articles online) to type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Application worked for me when I checked all these things and made changes in my application.
Submit this story to DotNetKicks