我已经将 WebSecurity.InitializeDatabase 的调用放在 _appstart.cshtml 中,如各种谷歌搜索中所述,但是在对 WebSecurity.IsAuthenticated 进行后续调用时,我会定期收到以下错误,例如,我假设每个用户都会调用一次 initialisedatabase进入网站,在调用_pagestart.cshtml之前这个初始化有延迟吗?
You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in an _AppStart.cshtml file in the root of your site.
at WebMatrix.WebData.SimpleMembershipProvider.VerifyInitialized()
at WebMatrix.WebData.WebSecurity.VerifyProvider()
at WebMatrix.WebData.WebSecurity.Logout()
at ASP._Page__PageStart_cshtml.Execute()