Description
Describe the bug
We have a pretty much the same issue as described in #9447. Two of our .NET Core 3.1.1 applications running in IIS with hostingModel="InProcess" started to throw errors below when app pool gets recycled and application restarts.
It looks like it started to happen right after the following patches were installed on our production server. Unfortunately problem show up only in our production environments even if all environments are kept the same in terms or patches.
Category: Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor
EventId: 43
An exception occurred while trying to decrypt the element.
Exception:
System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapiCore(Byte* pbProtectedData, UInt32 cbProtectedData, Byte* pbOptionalEntropy, UInt32 cbOptionalEntropy)
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapi(Byte[] protectedSecret)
at Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor.Decrypt(XElement encryptedElement)
Category: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager
EventId: 24
An exception occurred while processing the key element ''.
Exception:
System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapiCore(Byte* pbProtectedData, UInt32 cbProtectedData, Byte* pbOptionalEntropy, UInt32 cbOptionalEntropy)
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapi(Byte[] protectedSecret)
at Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor.Decrypt(XElement encryptedElement)
at Microsoft.AspNetCore.DataProtection.XmlEncryption.XmlEncryptionExtensions.DecryptElement(XElement element, IActivator activator)
at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement)
Category: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver
EventId: 12
Key {9e609506-dcbd-4191-a937-bc514cf9f564} is ineligible to be the default key because its CreateEncryptor method failed.
Exception:
System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapiCore(Byte* pbProtectedData, UInt32 cbProtectedData, Byte* pbOptionalEntropy, UInt32 cbOptionalEntropy)
at Microsoft.AspNetCore.DataProtection.Cng.DpapiSecretSerializerHelper.UnprotectWithDpapi(Byte[] protectedSecret)
at Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor.Decrypt(XElement encryptedElement)
at Microsoft.AspNetCore.DataProtection.XmlEncryption.XmlEncryptionExtensions.DecryptElement(XElement element, IActivator activator)
at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement)
at Microsoft.AspNetCore.DataProtection.KeyManagement.DeferredKey.<>c__DisplayClass1_0.<GetLazyDescriptorDelegate>b__0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyBase.get_Descriptor()
at Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyBase.CreateEncryptor()
at Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver.CanCreateAuthenticatedEncryptor(IKey key)
.NET 3.5
https://support.microsoft.com/en-us/help/4578981/kb4578981 - Security Only Update for .NET Framework 3.5 for Windows 8.1 and Windows Server 2012 R2 (KB4578981)
https://support.microsoft.com/en-us/help/4569737/kb4569737 - Security Only Update for .NET Framework 3.5 for Windows 8.1 and Windows Server 2012 R2 (KB4569737)
https://support.microsoft.com/en-us/help/4565580/kb4565580 - Security Only Update for .NET Framework 3.5 for Windows 8.1 and Windows Server 2012 R2 (KB4565580)
https://support.microsoft.com/en-us/help/4578953/kb4578953 - Security and Quality Rollup for .NET Framework 3.5 for Windows 8.1, RT 8.1, and Windows Server 2012 R2 (KB4578953)
.NET 4.8
https://support.microsoft.com/en-us/help/4576489/kb4576489 - Security Only Update for .NET Framework 4.8 for Windows 8.1 and Windows Server 2012 R2 (KB4576489)
https://support.microsoft.com/en-us/help/4565588/kb4565588 - Security Only Update for .NET Framework 4.8 for Windows 8.1 and Windows Server 2012 R2 (KB4565588)
https://support.microsoft.com/en-us/help/4569732/kb4569732 - Security Only Update for .NET Framework 4.8 for Windows 8.1 and Windows Server 2012 R2 (KB4569732)
https://support.microsoft.com/en-us/help/4578989/kb4578989 - Security Only Update for .NET Framework 4.8 for Windows 8.1 and Windows Server 2012 R2 (KB4578989)
https://support.microsoft.com/en-us/help/4578976/kb4578976 - Security and Quality Rollup for .NET Framework 4.8 for Windows 8.1, RT 8.1, and Windows Server 2012 R2 (KB4578976)
Further technical details
- ASP.NET Core version
3.1.1
- Include the output of
dotnet --info
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download