I've created an MVC 3 web application project and used the Nuget Package Manager to install the microsoft-mvc-helpers package. In order to get that to work I had to add a reference to WebMatrix.Data and WebMatrix.WebData (setting "Copy Local" to true).
When I try to run my project I get the following error:
this method cannot be called during the application's pre-start initialization stage.
And it points to the following section in my web.config (specifically the add tag):
<membership defaultProvider="ICNMemberProvider" userIsOnlineTimeWindow="60">
<providers>
<clear />
<add name="ICNMemberProvider" type="Website.Providers.ICNMemberProvider" />
</providers>
</membership>
This was working before I inst开发者_运维问答alled the microsoft-mvc-helpers package and works if I uninstall it. Any ideas why my customer Membership Provider and the helpers package would cause this error?
I found the answer to this question on another stack overflow question:
ASP.NET: This method cannot be called during the application's pre-start initialization stage
You just have to add the following to the appSettings section of your web.config:
<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false"/>
精彩评论