Usermanager缺少MVC 5项目中的方法?

时间:2015-03-13 16:10:23

标签: c# asp.net-mvc-5 usermanager

我遇到一个问题,其中各种方法在usermanager中不起作用。我尝试清除Resharper缓存甚至完全关闭resharper,但即使没有resharper运行,错误消息也是一样的。它坚持认为这些方法不存在。除了我正在研究的项目之外,它们在所有其他MVC项目中都能正常工作。

当我将鼠标悬停在其中一个方法上时,它会给我基本的“缺少使用指令或汇编参考”。它没有给我一个导入选项,所有的导入似乎都应该如此,但我的项目不会承认这些方法。

了解如何解决此问题?

As you can see it's like various methods doesn't even exist and if I disable resharper the normal error system just takes over and gives the same rror.

代码为文字:

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using MEV3.Models.Helpers;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using MEV3.Models;

正如您所看到的,我的所有导入都是正确的。

[HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);
                if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return View("ForgotPasswordConfirmation");
                }

                var code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
                var callbackUrl = Url.Action("ResetPassword", "Account",
                new { UserId = user.Id, code = code }, protocol: Request.Url.Scheme);
                await UserManager.SendEmailAsync(user.Id, "Reset Password",
                "Please reset your password by clicking here: <a href=\"" + callbackUrl + "\">link</a>");
                return View("ForgotPasswordConfirmation");
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }

0 个答案:

没有答案