ASP.NET membership: System.Web.Security. SqlRoleProvider problems

I had this really weird problem just now. I have done some work with the ASP.NET Membership provider and everything has been working great. But when i tried to deploy my application to the server i got this:

The ‘System.Web.Security.SqlRoleProvider’ 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_reqsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

Alright, my database was exactly the same and everything looked fine. I tried to recreate my database with the aspnet_regsql.exe tool but nothing worked. Then i finally found this thread on the MSDN messageboard and one guy said that he gave his application a name in the aspnet_Applications table and put that name in the web.config like this.

<add connectionStringName="ApplicationServices"
applicationName="APPLICATION NAME"
name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

And that solved it. Really really strange and i have no idea if this is a bug or whatever. On my local machine (Vista with IIS7) it worked great to have a application named “/” but on my production machin (a Server 2003 with IIS6) it did not.

Now i should stop working for today.

Leave a Reply