Missing field CalculateMd5ForResponseStream for DataProtection
See original GitHub issueHello,
We are upgrading one of our web apps from .Net Core 2.2 to 3.1 and with that all the packages. Right now we are having problems with our configuration of DataProtection using Azure blob storage. We are using the following version of the package and configuration code:
Microsoft.AspNetCore.DataProtection.AzureStorage 3.1.3
public static void UseAzureDataProtection(this IServiceCollection services, DataProtectionSettings settings)
{
var credentials = new StorageCredentials(settings.AccountName, settings.AccountKey);
var cloudStorageAccount = new CloudStorageAccount(credentials, true);
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference($"{settings.ApplicationName}-container");
container.CreateIfNotExistsAsync().GetAwaiter().GetResult();
services.AddDataProtection().PersistKeysToAzureBlobStorage(container, $"{settings.ApplicationName}-keys.xml");
}
Which throws the following error in the requests pipeline:
An error occurred while reading the key ring.
System.MissingFieldException: Field not found: 'Microsoft.Azure.Storage.Core.Executor.RESTCommand`1.CalculateMd5ForResponseStream'.
at Microsoft.Azure.Storage.Blob.CloudBlob.GetBlobImpl(BlobAttributes blobAttributes, Stream destStream, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options)
at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetLatestDataAsync(ICloudBlob blobRef)
at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElementsAsync(ICloudBlob blobRef)
at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElements()
at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh)
If we downgrade the package to the 2.2.7 version, with the same configuration code it works. The only thing is that we also need to update the using’s since they were changed from Microsoft.WindowsAzure.Storage
on 2.x.x to Microsoft.Azure.Storage
on 3.x.x.
In addition, I can see in the following commit that the field was removed, I just don’t know why it’s still trying to use it: https://github.com/Azure/azure-storage-net/commit/38f703c3d4d94f09f65b2b2f92f4f837d402fc42#diff-6d37e66772ae1b6ed4d77c52778c9336
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (3 by maintainers)
Top GitHub Comments
It’s a couple of months later and I ran into this issue today. The solution that worked for me was to update both packages Microsoft.Azure.Storage.Common and Microsoft.Azure.Storage.Blob from 10.0.3 to 11.1.7.
What was strange to me was that this was a production deployed Function App that suddenly stopped working.
Edit- It turns out the Functions runtime was updated to version 2.0.13759.0 which was the reason that our app stopped working suddenly. Release announcements are documented here https://github.com/Azure/app-service-announcements/issues
I also get this error, I’m trying to store the keys for the first time just following this excact example: Key storage providers - Azure
my-key-container
is created so the connection is working I even tried uploading the keys.xml created before turning on this featureI did not try any form of encryption