почему я получил это исключение ТОЛЬКО в производственной среде (CentOS 7)?
[ERR] Возникла исключительная ситуация при десериализации токена.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The
токен антиподделки не может быть расшифрован. --->
System.Security.Cryptography.CryptographicException: ключ
{d41af177-dd3c-460d-8280-5f46d79ae0e3} не был найден в кольце для ключей
Чего не хватает?
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDataProtection()
.SetApplicationName(Security.Application_Name)
.PersistKeysToFileSystem(new
DirectoryInfo(Security.Key_Path));
создан файл с именем key-dcee8f19-132e-4aff-84f0-7ef8c338533d.xml
расшифровать
var serviceCollection = new ServiceCollection();
serviceCollection.AddDataProtection()
.SetApplicationName(Security.Application_Name)
.PersistKeysToFileSystem(new DirectoryInfo(Security.Key_Path));
var services = serviceCollection.BuildServiceProvider();
var instance = ActivatorUtilities.CreateInstance<Cipher>(services);
string _mpid = instance.Decrypt(_xpid);