我们有一个基于ASP.NET MVC 4和Web API的现有应用程序.该网站的管理部分使用简单成员资格.我有兴趣将应用程序升级到MVC 5/Web API 2,以利用已添加的一些新功能.但看起来它们可能不兼容.
具体来说,在将NuGet中的RC包安装到我的解决方案中的一个项目中并更新web.config信息之后,应用程序在启动期间开始在调用的行上死亡WebSecurity.InitializeDatabaseConnection(),但有以下异常:
[MethodAccessException: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.OnConnectionOpened(System.Object, WebMatrix.Data.ConnectionEventArgs)' to access security critical method 'System.Web.WebPages.HttpContextExtensions.RegisterForDispose(System.Web.HttpContextBase, System.IDisposable)' failed.]
WebMatrix.WebData.PreApplicationStartCode.OnConnectionOpened(Object sender, ConnectionEventArgs e) +70
WebMatrix.Data.Database.OnConnectionOpened() +70
WebMatrix.Data.Database.EnsureConnectionOpen() +51
WebMatrix.Data.Database.QueryValue(String commandText, Object[] args) +63
WebMatrix.WebData.DatabaseWrapper.QueryValue(String commandText, Object[] parameters) +13
WebMatrix.WebData.SimpleMembershipProvider.GetUserId(IDatabase db, String userTableName, String userNameColumn, String userIdColumn, String userName) +206
WebMatrix.WebData.SimpleMembershipProvider.ValidateUserTable() +87
Run Code Online (Sandbox Code Playgroud)
使用我尚未升级的简单成员资格的同一解决方案中的其他项目继续正常工作.
当然,谷歌搜索更多信息会引发大量的点击,但WebMatrix没什么特别的.
FWIW:我知道Microsoft已经引入了(又一个)成员身份和身份解决方案,但除非有一种方法可以将其用于现有的简单成员资格表,或者是我们所有现有用户数据的无缝迁移路径,这不是一个真正的选择为了我们.
我刚刚尝试了一下我们应用程序当前主干的新结帐.我正在使用Visual Studio 2012,但是按照MS的说明升级现有项目.更新到MVC 5/Web API 2/EF 6后,该应用程序启动运行就好了.
web.config删除中没有明确的信任要求.我加入了代码这个问题来Global.asax.cs …
c# asp.net-mvc simplemembership asp.net-mvc-5 asp.net-identity