Asp.net-mvc – ASP.NET: This method cannot be called during the application’s pre-start initialization stage

asp.net-mvcasp.net-mvc-3

I'm trying to get an ASP.NET MVC 3 site running on IIS 6.0.

Currently when I request a page from the server it gives the following error:

Parser Error Message: This method cannot be called during the application's pre-start initialization stage.

on this line:

<add name="MyMembershipProvider" type="NS.MyMembershipProvider" connectionStringName="MyDatabase" applicationName="/MySite"/>

I'm completely stumped and don't have much of a clue about the ASP.NET application lifecycle, let alone the differences between 6.0 and 7.0. Reading through the MSDN pages on it hasn't seemed to help much.

Does anyone have any insight or any good links for investigation? 🙂

Best Answer

Add this in your web.config (in the appSettings section):

<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false"/>

EDIT:

For the ones who ask why, it is a known issue described in the mvc 3 release notes More details here

Related Topic