Azure BlobClient.Upload omits content under Internet Information System

Viewed 112

Working in .NET, I'm using Azure.Storage.Blobs v12.10.0. Everything has worked well in a proof-of-concept console program and in unit tests. Now, running in our Web Services project under Internet Information Server, the method BlobClient.Upload() is failing.

It is generating a PUT call similar to this:

PUT https://ouraccount.blob.core.windows.net/bbbb0001/04/0458f03f-e873-ec11-832b-90ccdfb38f8e/1_0_0/0b58f03f-e873-ec11-832b-90ccdfb38f8e.png HTTP/1.1
x-ms-blob-type: BlockBlob
x-ms-version: 2020-10-02
Accept: application/xml
Content-Type: application/octet-stream
x-ms-client-request-id: ec6aa2fb-e633-48be-8641-99de57a88650
x-ms-return-client-request-id: true
User-Agent: azsdk-net-Storage.Blobs/12.10.0 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19042 )
x-ms-date: Wed, 12 Jan 2022 20:44:39 GMT
Authorization: secret
Host: ouraccount.blob.core.windows.net
Content-Length: 3256
Expect: 100-continue

But there is no content, so it generates this response:

HTTP/1.1 408 Request body incomplete
Date: Wed, 12 Jan 2022 20:44:39 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 15:44:39.797

The request body did not contain the specified number of bytes. Got 0, expected 3,256                                                                                                                                                                                                                                                                                                                                                                                                                                           

It retries 5 more times with the same result before throwing an exception:

The request was aborted: The request was canceled.

Identical calls outside of IIS include the content.

These two overloads of BlobClient.Upload behave the same: Response Upload(Stream content, bool overwrite = false, CancellationToken cancellationToken = default); Response Upload(string path, bool overwrite = false, CancellationToken cancellationToken = default);

Anyone?

The stack trace from the exception thrown when the server rejects the PUT with no content six times:

System.AggregateException
  HResult=0x80131500
  Message=Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry.
  Source=Azure.Core
  StackTrace:
   at Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Azure.Core.Pipeline.RetryPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipeline.Send(HttpMessage message, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlockBlobRestClient.Upload(Int64 contentLength, Stream body, Nullable`1 timeout, Byte[] transactionalContentMD5, String blobContentType, String blobContentEncoding, String blobContentLanguage, Byte[] blobContentMD5, String blobCacheControl, IDictionary`2 metadata, String leaseId, String blobContentDisposition, String encryptionKey, String encryptionKeySha256, Nullable`1 encryptionAlgorithm, String encryptionScope, Nullable`1 tier, Nullable`1 ifModifiedSince, Nullable`1 ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String blobTagsString, Nullable`1 immutabilityPolicyExpiry, Nullable`1 immutabilityPolicyMode, Nullable`1 legalHold, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.Specialized.BlockBlobClient.<UploadInternal>d__33.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Azure.Storage.Blobs.Specialized.BlockBlobClient.<>c__DisplayClass62_0.<<GetPartitionedUploaderBehaviors>b__0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Azure.Storage.PartitionedUploader`2.<UploadInternal>d__19.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Azure.Storage.Blobs.BlobClient.<StagedUploadInternal>d__41.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Azure.Storage.Blobs.BlobClient.Upload(Stream content, BlobHttpHeaders httpHeaders, IDictionary`2 metadata, BlobRequestConditions conditions, IProgress`1 progressHandler, Nullable`1 accessTier, StorageTransferOptions transferOptions, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobClient.Upload(Stream content, Boolean overwrite, CancellationToken cancellationToken)
   at Astria.Framework.FileSystemProvider.AzureBlob.WriteStream(String path, Stream data) in C:\Users\ira.whitman\source\repos\DocStarECM\Astria.Framework.FileSystemProvider\AzureBlob.cs:line 360
   at Astria.Framework.FileSystemProvider.AzureBlob.Copy(String sourcePath, String destination, Boolean deleteFromSource) in C:\Users\ira.whitman\source\repos\DocStarECM\Astria.Framework.FileSystemProvider\AzureBlob.cs:line 377
   at Astria.Framework.FileSystemProvider.AzureBlob.Move(String sourcePath, String destinationPath) in C:\Users\ira.whitman\source\repos\DocStarECM\Astria.Framework.FileSystemProvider\AzureBlob.cs:line 314
   at Astria.Framework.FileSystemProvider.AzureBlob.<CommitParallelWrites>b__24_0(Int32 i) in C:\Users\ira.whitman\source\repos\DocStarECM\Astria.Framework.FileSystemProvider\AzureBlob.cs:line 132
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
RequestFailedException: The request was aborted: The request was canceled.
1 Answers

Resolved. Our server solution had references to several Microsoft packages that were older versions than the ones I added with Azure.Storage.Blobs, including System.Buffers and System.Memory. Consolidating all of these multi-version references to the later ones was the cure.

Related