Was working on the beginnings of a new project and building up a database just by using a file based database connecting with SQL Express. When it’s actually deployed, it’ll be on a full SQL Server, so I scripted the database and executed the script on my local SQL Server. The database already had the membership tables built in. I also knew that I’d not be connecting to it via sa for obvious reasons, so I created a stripped down SQL account to connect with. Good enough.
So, modify web.config to change the connection string and the each of the provider entries to point to the new connection string. Simple enough.
Run the application connecting to the server and greeted with this:
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.
Things that make you go hmmmm…
So, I quickly Google with Bing and find this. http://forums.asp.net/p/985097/1267872.aspx. Ok, fair enough, I did just script it rather installing it. So I ran aspnet_regsql to remove everything then ran it again to add it all. Ok, the schema table that’s mentioned in that article is populated and anything else that might get missed from scripting should be there as well, right? Right … well…
Run it again and same error. Ok, change the connection to use sa and run again. Works. Ok, permissions issue. Originally had the permissions set up for the account that I wanted to use for the application:
Scrolling up a bit however, I notice a bunch of permissions just for all the membership stuff.
Ah, all I’m using right now is basic reads from the membership stuff, so just gave the account the above permissions and we are in business!
Hope this helps someone else along the way!