简体   繁体   English

WebMatrix WebData InitializeDatabaseConnection

[英]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.

相关问题 Webmatrix.WebData登录方法导致异常 - Webmatrix.WebData Login method results in exception 在WPF应用程序中使用WebMatrix.WebData.WebSecurity - Using WebMatrix.WebData.WebSecurity in a WPF application 使用Microsoft Fake Framework MVC4单元测试WebMatrix.WebData - Unit testing WebMatrix.WebData with Microsoft Fake Framework MVC4 是什么导致 WebMatrix.Data.dll 和 WebMatrix.WebData.dll 添加到我的 bin 目录中 - What causing WebMatrix.Data.dll and WebMatrix.WebData.dll to be added to my bin directory 我尝试使用WebMatrix.WebData,但即使卸载了该包,也一直收到此错误 - I tried to use WebMatrix.WebData, but keep getting this error, even after I uninstalled the package 无法将类型'System.Web.Security.MembershipProvider'隐式转换为'WebMatrix.WebData.ExtendedMembershipProvider' - Cannot implicitly convert type 'System.Web.Security.MembershipProvider' to 'WebMatrix.WebData.ExtendedMembershipProvider' 使用MySql的Webmatrix.WebData.WebSecurity无法正常工作。 WebSecurity.UserExists()检查中引发SQL语法错误 - Webmatrix.WebData.WebSecurity with MySql is not working. Throwing sql syntax error in WebSecurity.UserExists() check WebMatrix.WebData无法从单独的ASP.NET应用程序中读取成员资格信息 - WebMatrix.WebData can't read membership information from a separate ASP.NET application 无法获取MVC5中引用的用于简单成员资格的Webmatrix.WebData? - Can't get Webmatrix.WebData for Simple Membership referenced in MVC5? WebMatrix.WebData.WebSecurity - 如何只通过PasswordResetToken获取UserName - WebMatrix.WebData.WebSecurity - How can I get UserName by only having PasswordResetToken
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM