asp.net-mvc – MVC4 SimpleMemberhip’提供商遇到了未知错误.

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – MVC4 SimpleMemberhip’提供商遇到了未知错误.前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用sql Azure数据库使用SimpleMembership和MVC4.

我得到一个例外

  1. The Provider encountered an unknown error.

没有内部异常,在这行代码上:

  1. WebSecurity.CreateAccount("test@test.com","23iu$9835",false);

我的控制器上有这个过滤器

  1. [InitializeSimpleMembership]

其中包含此InitializeDatabaseConnection

  1. WebSecurity.InitializeDatabaseConnection("DefaultConnection","User","Id","Email",autoCreateTables: false);

我已经仔细检查了我的连接字符串,它似乎工作正常.

由于异常没有提供有用的信息,因此我很难调试此问题.有没有人有任何想法,为什么我可能有这个问题,或指出我正在开始调试问题的正确方向?

编辑:这是完整的堆栈跟踪:

  1. [MembershipCreateUserException: The Provider encountered an unknown error.]
  2. WebMatrix.WebData.SimpleMembershipProvider.CreateAccount(String userName,String password,Boolean requireConfirmationToken) +514
  3. WebMatrix.WebData.WebSecurity.CreateAccount(String userName,Boolean requireConfirmationToken) +75
  4. Nexus.Areas._Internal.Controllers.HomeController.Index() in c:\54Projects\Nexus\Nexus\Areas\_Internal\Controllers\HomeController.cs:38
  5. lambda_method(Closure,ControllerBase,Object[] ) +101
  6. System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller,Object[] parameters) +59
  7. System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary`2 parameters) +435
  8. System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary`2 parameters) +60
  9. System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeSynchronousActionMethod(ControllerContext controllerContext,IDictionary`2 parameters) +50
  10. System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +75
  11. System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +44
  12. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
  13. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +102
  14. System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
  15. System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +126
  16. System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +323
  17. System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +323
  18. System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +44
  19. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
  20. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +102
  21. System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
  22. System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +68
  23. System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +184
  24. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +136
  25. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +56
  26. System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
  27. System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +40
  28. System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
  29. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  30. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +59
  31. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +40
  32. System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
  33. System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
  34. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  35. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +40
  36. System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
  37. System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
  38. System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +45
  39. System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47
  40. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  41. System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag) +40
  42. System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
  43. System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
  44. System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628700
  45. System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +155

解决方法

试试这个
  1. WebSecurity.CreateUserAndAccount("test@test.com",false);

猜你在找的asp.Net相关文章