Docker issue: System.Security.Cryptography.CryptographicException

Product: PowerShell Universal
Version: 3.0.2

Starting the docker container seems to be fine for a bit but after awhile the server quits responding. The docker container never crashes but only fix is to restart the container.

DevTools was showing this

Logs:

System.Security.Cryptography.CryptographicException: The key {c035f012-7098-45fa-a379-9a46822feca3} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
[11:20:40 WRN] Error unprotecting the session cookie.

System.Security.Cryptography.CryptographicException: The key {c035f012-7098-45fa-a379-9a46822feca3} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
[11:22:14 WRN] Error unprotecting the session cookie.

System.Security.Cryptography.CryptographicException: The key {c035f012-7098-45fa-a379-9a46822feca3} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
[11:22:14 WRN] Error unprotecting the session cookie.

The error you are seeing is typically when an old cookie is in a browser and you are connecting to a new PSU instance at the same URL. You can try to clear your cookies to see if that goes away. The connection refused typically means that the server isn’t yet listening at the port. Can you let me know the last few lines in the log? Seems hung during startup.

Clearing cookies does nothing.

This is what is in the logs.

2022-06-19 09:55:49.268 -05:00 [WRN] Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {c035f012-7098-45fa-a379-9a46822feca3} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
2022-06-19 09:56:38.577 -05:00 [WRN] Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {c035f012-7098-45fa-a379-9a46822feca3} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)

Interesting. I’ve opened an issue for this here so we can try to investigate why this happens.

Not sure if it makes any difference or not but im hosting the docker in unraid…