繁体   English   中英

WebMatrix WebData InitializeDatabaseConnection

[英]WebMatrix WebData InitializeDatabaseConnection

我已经在_appstart.cshtml中将对WebSecurity.InitializeDatabase的调用放置在_appstart.cshtml中,如在各种Google搜索中所指出的那样,但是在对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()

不,不应该延迟。

要使用WebSecurity.InitializeDatabaseConnection,请使用参数autoCreateTables = true调用一次。 在数据库中设置表之后,然后在_appstart中,您将使用autoCreateTables = False调用WebSecurity.InitializeDatabaseConnection。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM