You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

单Azure实例上6个未配置Data Protection的.NET Core 8应用出现CryptographicException

问题:Azure Web App中多.NET Core 8应用共享数据保护密钥时频繁抛出CryptographicException

我在单个Azure Web App实例中托管了6个.NET Core 8 Web应用,所有应用均未通过services.AddDataProtection()显式配置数据保护API,默认使用C:\home\ASP.NET\DataProtection-Keys存储数据保护密钥。我已通过检查activationDate和expirationDate元素确定了目录中的活动密钥文件,但所有应用仍每隔约5分钟就向Azure Application Insights记录一次System.Security.Cryptography.CryptographicException异常,堆栈信息如下:

System.Security.Cryptography.CryptographicException:
   at Microsoft.AspNetCore.DataProtection.Cng.CbcAuthenticatedEncryptor.DecryptImpl (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.DataProtection.Cng.Internal.CngAuthenticatedEncryptorBase.Decrypt (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.Session.CookieProtection.Unprotect (Microsoft.AspNetCore.Session, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)

已完成的排查

  • 确认所有应用访问同一密钥文件
  • 排查文件访问及权限问题,未发现异常
  • 检查Azure诊断日志,未找到相关问题

咨询问题

  1. 基于当前配置,如何进一步诊断该异常的原因?
  2. 有哪些推荐的配置变更可解决此类频繁出现的异常?

内容的提问来源于stack exchange,提问作者Matt W

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 04:50:07