如何解决从 xamarin 应用程序上传到 blob 存储
我有一个内置于 Xamarin 的移动应用程序。我有一个录制视频的功能,然后我需要将它上传到 Blob 存储。视频大小可能是 100 MB 或 200 MB。下面是代码
BlobServiceClient client = new BlobServiceClient("storageConnectionString");
BlobContainerClient containerClient = client.GetBlobContainerClient("ContainerName");
BlobClient blobClient = containerClient.GetBlobClient(fileName);
MemoryStream memoryStream = new MemoryStream("Array of bytes");
await containerClient.UploadBlobAsync("fileName",memoryStream);
memoryStream.Close();
memoryStream.dispose();
尝试上传大型视频(例如 60 MB 视频)时出现以下异常
Retry Failed after 6 tries. (The operation was canceled.) (The operation was canceled.)
(The operation was canceled.) (The operation was canceled.) (The operation was canceled.)
(The operation was canceled.)
at Azure.Core.Pipeline.RetryPolicy.ProcessAsync (Azure.Core.HttpMessage message,System.ReadOnlyMemory`1[T] pipeline,System.Boolean async) [0x001b8] in
<bc1a25630f42495eb986d0b74fe4ff40>:0
at Azure.Core.Pipeline.HttpPipelinesynchronousPolicy.ProcessAsync (Azure.Core.HttpMessage message,System.ReadOnlyMemory`1[T] pipeline) [0x00086] in <bc1a25630f42495eb986d0b74fe4ff40>:0
at Azure.Core.Pipeline.HttpPipelinesynchronousPolicy.ProcessAsync (Azure.Core.HttpMessage message,System.ReadOnlyMemory`1[T] pipeline) [0x00086] in <bc1a25630f42495eb986d0b74fe4ff40>:0
at Azure.Storage.Blobs.BlobRestClient+BlockBlob.UploadAsync (Azure.Core.Pipeline.ClientDiagnostics
clientDiagnostics,Azure.Core.Pipeline.HttpPipeline pipeline,System.Uri resourceUri,System.IO.Stream body,system.int64 contentLength,System.String version,System.Nullable`1[T]
timeout,System.Byte[] transactionalContentHash,System.String blobContentType,System.String
blobContentEncoding,System.String blobContentLanguage,System.Byte[] blobContentHash,System.String
blobcacheControl,System.Collections.Generic.IDictionary`2[TKey,TValue] Metadata,System.String
leaseId,System.String blobContentdisposition,System.String encryptionKey,System.String
encryptionKeySha256,System.Nullable`1[T] encryptionAlgorithm,System.String encryptionScope,System.Nullable`1[T] tier,System.Nullable`1[T] ifModifiedSince,System.Nullable`1[T]
ifUnmodifiedSince,System.Nullable`1[T] ifMatch,System.Nullable`1[T] ifNoneMatch,System.String
ifTags,System.String requestId,System.String blobTagsstring,System.Boolean async,System.String
operationName,System.Threading.CancellationToken cancellationToken) [0x001e2] in
<306eef6cb8644c19b928e83686007d43>:0
at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x0001b] in
/Users/builder/jenkins/workspace/archive-mono/2020-
02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at Azure.Storage.Blobs.Specialized.BlockBlobClient.UploadInternal (System.IO.Stream content,Azure.Storage.Blobs.Models.BlobHttpHeaders blobHttpHeaders,TValue] tags,Azure.Storage.Blobs.Models.BlobRequestConditions conditions,System.Nullable`1[T] accesstier,System.IProgress`1[T] progressHandler,System.String operationName,System.Threading.CancellationToken cancellationToken) [0x00334] in
<306eef6cb8644c19b928e83686007d43>:0
at Azure.Storage.Blobs.Specialized.BlockBlobClient+<>c_displayClass54_0.
<GetPartitionedUploaderBehaviors>b_0 (System.IO.Stream stream,Azure.Storage.Blobs.Models.BlobUploadOptions args,System.Threading.CancellationToken
cancellationToken) [0x000c9] in <306eef6cb8644c19b928e83686007d43>:0
at Azure.Storage.PartitionedUploader`2[TServiceSpecificArgs,TCompleteUploadReturn].UploadInternal
(System.IO.Stream content,TServiceSpecificArgs args,System.Threading.CancellationToken cancellationToken) [0x001ce] in
<306eef6cb8644c19b928e83686007d43>:0
at Azure.Storage.Blobs.BlobClient.StagedUploadInternal (System.IO.Stream content,Azure.Storage.Blobs.Models.BlobUploadOptions options,System.Threading.CancellationToken cancellationToken) [0x001c5] in
<306eef6cb8644c19b928e83686007d43>:0
at Azure.Storage.Blobs.BlobContainerClient.UploadBlobAsync (System.String blobName,System.IO.Stream
content,System.Threading.CancellationToken cancellationToken) [0x00083] in
<306eef6cb8644c19b928e83686007d43>:0
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。