I use my own custom Membership and Role providers in Since MVC2 and ran into this issue when I migrated from MVC3 to 4.
I created a new project in MVC4 / .net4.5 EF5 and had the miss-fortune to encounter this error.
I managed to fix it by doing the following:
Add this to your webconfig appsettings:
<appSettings>
<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false"/>
</appSettings>
Add your connection string to your memberships and roles providers if not already set:
<membership defaultProvider="MyMembershipProvider">
<providers>
<add name="MyMembershipProvider" type="AMS.WebUI.Infrastructure.CustomMembershipProvider" connectionStringName="EFDbContext" />
</providers>
</membership>
<roleManager defaultProvider="MyRoleprovider">
<providers>
<add name="MyRoleprovider" type="AMS.WebUI.Infrastructure.CustomRoleProvider" connectionStringName="EFDbContext" />
</providers>
</roleManager>
This resolved the issue for me and I hope it can help you.