2

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 installed 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?

Austin
  • 4,638
  • 7
  • 41
  • 60
  • I don't think there is a package named microsoft-mvc-helpers. Did you mean microsoft-web-helpers? Also, can you include the stack of the exception you're getting. Thanks! – David Ebbo Feb 25 '11 at 19:03
  • @David, there is no stack, it says it is a configuration error and points to the section I included of the web.config – Austin Apr 28 '11 at 14:31

1 Answers1

4

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"/>
Community
  • 1
  • 1
Austin
  • 4,638
  • 7
  • 41
  • 60