簡體   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