Iis Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery部署时
背景:我在IIS10上的Windows 2019服务器上部署了一个小型.NET核心web应用程序。(在AWS EC2 t2.micro上) 1.我的web应用程序已经成功运行了大约一个月。我有 经常对服务器部署更改,直到 今天 2.在我的本地主机上工作 当我上传更改时,现在登录时出现错误。我已经在控制器上对用户/传递进行了硬编码,因此我不明白为什么突然出现此错误Iis Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery部署时,iis,.net-core,iis-10,antiforgerytoken,Iis,.net Core,Iis 10,Antiforgerytoken,背景:我在IIS10上的Windows 2019服务器上部署了一个小型.NET核心web应用程序。(在AWS EC2 t2.micro上) 1.我的web应用程序已经成功运行了大约一个月。我有 经常对服务器部署更改,直到 今天 2.在我的本地主机上工作 当我上传更改时,现在登录时出现错误。我已经在控制器上对用户/传递进行了硬编码,因此我不明白为什么突然出现此错误 ActionName: UploadFile.Controllers.LoginController.Index (UploadFil
ActionName: UploadFile.Controllers.LoginController.Index (UploadFile)
An exception was thrown while deserializing the token.
Exception:
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
---> System.Security.Cryptography.CryptographicException: The key {6e631e8e-a970-4ab7-bddc-4b68c37f9aac} was not found in the key ring.
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
控制器代码如下所示
[HttpPost]
public IActionResult Index(string inputEmail, string inputPassword)
{
if (inputEmail == "email@em.com" && inputPassword =="pass"){
return RedirectToAction("Index", "Dashboard", new { area = "" });
}
ViewBag.Error = true;
return View();
}
这种观点有:
<form class="form-signin" asp-action="Index" style="padding-top: 25px;">
我增加了服务器的内存。我使用的是t2.micro类型的AWS虚拟机,内存为1GB