部分代码在本地主机上运行正常,但在服务器 (IIS) 上出错



我的登录方法在本地主机上正常运行,但是当我在服务器上发布时,收到ArgumentNullException错误

我的同名斯帕斯。Controllers.d__11.MoveNext(( in E:\mylocaldirectory\myassembly\Controllers\M_AccountController.cs:179

奇怪的是,为什么

错误在服务器上显示我的本地地址,以及为什么我的代码在本地主机上正常运行,但在服务器上出现具有相同代码的错误

实际上,我真正的问题是这一行"E:\mylocaldirectory\myassembly\Controllers\M_AccountController.cs:179">[这是我错误的图片][ https://i.stack.imgur.com/IUBTP.jpg]

[HttpPost]
        public virtual async Task<ActionResult> Check_Code_4_Login(string code, string phoneNumber, string returnUrl)
        {
            var baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority;
            var dtNow = DateTime.Now;
            var _code = Convert.ToInt32(code);
            var userActiveCode = await _userActiveCodeService
                .FindFirstAsync(p =>
                    p.PhoneNumber == phoneNumber &&
                    p.ActiveCode == _code &&
                    p.ActiveCodeExpireDate > dtNow &&
                    p.Used == false &&
                    p.Enabled);
            if (userActiveCode == null)
            {
                TempData["Error"] = "Code Incorrect";
                return RedirectToAction(nameof(PostedLogin),new {phoneNumber=phoneNumber, reagentCode="",returnUrl="" });
            }
            var user = await _userManager.FindByPhoneNumberAsync(userActiveCode.PhoneNumber);
            if (user == null)
            {
                    var _user = new User
                    {
                        UserName = phoneNumber,
                        PhoneNumber = phoneNumber,
                        RegisterDate = dtNow
                    };
                    var res = await _userManager.CreateAsync(_user);
                    if (res == IdentityResult.Success)
                    {
                        user = _user;
                        await _userManager.AddToRoleAsync(user.Id, "Customer");
                    }
                    else
                    {
                        //todo Error
                        throw new Exception("Registeration Error");
                    }
            }
            await _signInManager.SignInAsync(user, true, true);
            var userIdentity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);

            return Redirect(returnUrl != null ? returnUrl : baseUrl);
        }```
I expect the output of the login method to be login user on the server or have an error on local, but the actual output is login user on local and have an error on server

实际上这些是程序集发布的位置它与您的本地计算机无关,如果您在其他客户端上尝试,您将看到相同的内容

相关内容

  • 没有找到相关文章