我通过查看这个解决了这个问题:https ://docs.microsoft.com/en-us/aspnet/core/security/data-protection/implementation/key-storage-providers#azure-and-redis
以下是我采取的基本步骤:
创建一个 Blob 存储帐户来存储共享密钥。
将以下代码添加到您的 Startup.cs:
var storageAccount = CloudStorageAccount.Parse("blob storage connection string");
//Create the blob client object.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
//Get a reference to a container to use for the sample code, and create it if it does not exist.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
container.CreateIfNotExists();
services.AddDataProtection()
.SetApplicationName("MyApplication")
.PersistKeysToAzureBlobStorage(container, "myblobname");
就是这样。