I am developing a code first web app in Visual Studio 2012 Express.
I use this connection string in the web.config:
Add this code to Global.asax.cs
. This will makes sure that your database is always Initialized before any other executions. Also make sure its the first registration in Application_Start()
if (!WebSecurity.Initialized)
WebSecurity.InitializeDatabaseConnection("DefaultConnection",
"UserProfile", "UserId", "UserName", autoCreateTables: true);
Get rid of Filters/InitializeSimpleMembershipAttribute.cs
or just comment the code inside, in case you would like to go back to it.
Remove [InitializeSimpleMembership]
at the top of AccountController.cs
Also if you haven't already enabled migrations, i would encourage you do so. That way, you can do your seeds in Configuration.cs
created inside the Migration folder
when you run Enable-Migrations