相关疑难解决方法(0)

将SimpleMembership迁移到Identity 2.0

这个问题已经发展,所以我更新了标题.

这是原始标题:Identity 2 UserManager.Find抛出"无效的对象名称'dbo.ApplicationUser'"错误

我正在从SimpleMembership转换为Identity 2.我已经运行了转换脚本并重构了各种文件以供Identity使用.我可以构建并运行应用程序,但是当尝试登录"无效对象名称'dbo.ApplicationUser'"时,会在var user = UserManager.Find(vM.UserName,vM.Password)上抛出错误;

账户管理员:

  [RequireHttps]
  [Authorize]
  public class AccountController : Controller
  {
    private readonly IUserService _userService;

    public UserManager<ApplicationUser> UserManager { get; private set; }

    public AccountController() 
    : this(new UserService(), new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new MyDb()))) { } 

    public AccountController(IUserService userService, UserManager<ApplicationUser> userManager)
    { _userService = userService; UserManager = userManager; }

    // GET: /Account/Login
    [AllowAnonymous]
    public ActionResult Login() { return View(); }

    // POST: /Account/Login
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult Login(LoginVm vM)
    { 
      if (ModelState.IsValid) 
      { 
        var …
Run Code Online (Sandbox Code Playgroud)

asp.net-identity entity-framework-6.1

6
推荐指数
1
解决办法
3081
查看次数