I have created my application domain model using EF 5 Code First. I am then attempting to hook that with the ASP.NET Default Membership provider by running aspnet_reqsql.exe utility to generate the membership tables in my database.
This seems to be working fine, because when I check the database in SQL Management Studio, all the membership tables are there, along with my Code First tables.
Now then, we I run my application, all seems good, it loads up and I can browse the pages. However, as soon as I browse something that requires membership (e.g. Login page) the application breaks. I get the Yellow Screen of Death with the following message:
Server Error in '/' Application.
Connection string "DefaultConnection" was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Connection string "DefaultConnection" was not found.
Source File: c:\Users\XXX\Documents\Visual Studio 2012\Projects\YourApp\YourApp\Filters\InitializeSimpleMembershipAttribute.cs Line: 41
There is this thread by a User that faced a similar problem, however his solution is already implemented by me, the fact that I have to comment out the already existing connection string in web.config
. I've done that, but still no success.
What am I doing wrong?
Where you call InitializeSimpleMembershipAttribute
, if you still have "DefaultConnection"
as the first parameter, then you need to change this to be the name of the connection you want it to use.