asp.net-mvc – WebSecurity.InitializeDatabaseConnection方法只能调用
发布时间:2020-05-24 05:58:29 所属栏目:asp.Net 来源:互联网
导读:我正在尝试 Windows Azure来托管一个MVC4 Web应用程序. 我创建了一个测试应用程序,使用VS2012 MVC4互联网应用程序模板,并添加了一个自定义的模型和控制器. 我已经在Azure上发布了它,并设法将“update-database”应用于Azure数据库. 当我在本地尝试应用程序,但
|
我正在尝试
Windows Azure来托管一个MVC4 Web应用程序.
我已经在Azure上发布了它,并设法将“update-database”应用于Azure数据库. 当我在本地尝试应用程序,但使用Azure SQL数据库,它的工作正常. 当我在线尝试应用程序,我可以使用测试控制器,但登录或注册链接给出以下异常: Server Error in '/' Application. The "WebSecurity.InitializeDatabaseConnection" method can be called only once. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The "WebSecurity.InitializeDatabaseConnection" method can be called only once. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The "WebSecurity.InitializeDatabaseConnection" method can be called only once.] WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership,DatabaseConnectionInfo connect,String userTableName,String userIdColumn,String userNameColumn,Boolean createTables) +123 WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect,Boolean autoCreateTables) +51 WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName,Boolean autoCreateTables) +52 MembershipTest2.Filters.SimpleMembershipInitializer..ctor() +193 你有什么想法来自哪里? 谢谢. 解决方法您可以尝试将该调用封装到该方法中,以确保不再调用一次if (!WebMatrix.WebData.WebSecurity.Initialized)
{
WebSecurity.InitializeDatabaseConnection(...);
} (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.net – 多个上传与jQuery多文件上传插件
- asp.net – Web发布的密码不同于我的Azure管理员密码?
- asp.net-mvc – asp.net mvc如何正确测试控制器
- 在没有ViewState ASP.Net的情况下获取当前页面的HTML
- ASP.NET:将内容注入所有Response流
- asp.net-mvc – Asp.net MVC授权属性,重定向到自定义“无权
- asp.net – 网页中的电子签名[已关闭]
- asp.net-mvc-3 – MVC3强制验证隐藏字段
- asp.net-mvc – Durandal和ASP.NET MVC约定
- 为什么我的ASP.NET MVC持久性的auth cookie不起作用?
推荐文章
站长推荐
- asp.net – Gridview编辑,点击两次问题
- ASP.NET MVC 5和Bootstrap 3
- 我们可以在ASP.NET Webforms(* .aspx页面)中使用
- asp.net-mvc – 如何改变jslint(VS 2010扩展)忽略
- asp.net-mvc – 使用mvc-mini-profiler
- asp.net – RenderBody()和RenderSection()必须在
- asp.net – 简单LINQ和列表错误:WhereListItera
- SimpleMembership与ASP.NET MVC 4中的自定义数据
- asp.net – 如何以编程方式触发dropdownlist.sel
- asp.net-mvc – 如何在asp.net中使用mvc构建购物
热点阅读
