Hello every one. I'm new in asp.net. I've created a web application with asp.net. I've used of Microsoft account manager. When I want to register a new user, It give me below error and I don't know what to do. It was working before and I have a user in database. But now it doesn't work! I didn't change anything in account code area. Because I didn't write it. I've used of migration and entity framework.

{“Message”:“发生错误 . ”,“ExceptionMessage”:“对象引用未设置为对象的实例 . ”,“ExceptionType”:“System.NullReferenceException”,“StackTrace”:“在FarmingServer . E:\ Unity Projects \ FarmingServer \ FarmingServer \ Controllers \ AccountController.cs中的Controllers.AccountController.d__20.MoveNext():第337行\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Threading.Tasks.TaskHelpersExtensions.d__3` 1.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束---在系统上的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n中的\ r \ n System.Web.Http.Controllers.ApiControllerActionInvoker.d__中的.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n 0.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在系统.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在系统中System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\ r \ n中的.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Web.Http的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n中 . Filters.AuthorizationFilterAttribute.d__2.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n \ n在System.Web.Http.Controllers.AuthenticationFil的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n中terResult.d__0.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()“}

And this the Register code:

[AllowAnonymous]
    [Route("Register")]
    public async Task<IHttpActionResult> Register(RegisterBindingModel model)/////////////////////////////////
    {

        if (!ModelState.IsValid)
        {
            return BadRequest(ModelState);
        }

        //if (model.Password != "wctjm*p!M',Y{%/bE>aS?$vUn3r]AC:Gs~D_62Q(X}d9;5&R[" || model.Email != "t~cSz#2rjm+T.*vLA]3J_8}@w^G%'a$?f95F[qBKW-)!gX;seu")
        //    return BadRequest("oooops");

        var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

        IdentityResult result = await UserManager.CreateAsync(user, model.Password);

        if (!result.Succeeded)
        {
            return GetErrorResult(result);
        }
        return Ok();
    }

错误在这里(第337行):

IdentityResult result = await UserManager.CreateAsync(user, model.Password);