[英]WebMatrix WebData InitializeDatabaseConnection
I have placed the call to WebSecurity.InitializeDatabase in the _appstart.cshtml as noted in various google searches but periodically I keep receiving the below error when making subsequent calls to WebSecurity.IsAuthenticated for example, I would assume the initialisedatabase is called once for every user entering the website, is there a delay in this initialization before the _pagestart.cshtml is called? 我已经在_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()
No, there should not be a delay. 不,不应该延迟。
To use WebSecurity.InitializeDatabaseConnection, you call once ever with the parameter autoCreateTables= true. 要使用WebSecurity.InitializeDatabaseConnection,请使用参数autoCreateTables = true调用一次。 After your tables are setup in your database, then from then on in _appstart, you'll call WebSecurity.InitializeDatabaseConnection with autoCreateTables = False. 在数据库中设置表之后,然后在_appstart中,您将使用autoCreateTables = False调用WebSecurity.InitializeDatabaseConnection。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.