The ASP.NET Simple Membership database could not be initialized. – When navigating to a page in an MVC application.

To solve this problem, your fix may be listed here http://go.microsoft.com/fwlink/?LinkId=256588 as described in the exception, but it didn’t help me.

Even though I had two DbContext classes, consolidating those did not help.

My actual problem was that

  • I had renamed the “DefaultConnection” connection string entirely from the project, preferring it to live in my own named connection.
  • I had changed this in all DbContext classes.
  • But  I hadn’t and hadn’t changed the line of code in the \Filters\InitializeSimpleMembershipAttribute.cs class to match.

 

Of course, rather than just replacing the string – I did what a proper programmer should do. I made a constant (or you can expose it as a property of a class).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s