azure-storage-net | Microsoft Azure Storage Libraries for .NET | Azure library
kandi X-RAY | azure-storage-net Summary
kandi X-RAY | azure-storage-net Summary
Microsoft Azure Storage Libraries for .NET
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of azure-storage-net
azure-storage-net Key Features
azure-storage-net Examples and Code Snippets
Community Discussions
Trending Discussions on azure-storage-net
QUESTION
ANSWER
Answered 2020-Jul-02 at 02:57Did you check the workaround mentioned here?
Seems you need to use the GetEnvironmentVariable
QUESTION
So we started using blob storage in our ASP.NET Core 3.1 web app, I noticed that there are two .NET Microsoft libraries for handling blob storage uploads and operations.
Azure.Storage.Blobs
Azure Storage Blobs client library for .NET: This is the more active of two repos and it is mentioned in the docs.Microsoft.Azure.Storage.DataMovement
Microsoft Azure Storage Data Movement Library: Which has a dependency on the older version ofAzure.Storage.Blobs
and have this vague descriptionThe Microsoft Azure Storage Data Movement Library designed for high-performance uploading, downloading and copying Azure Storage Blob and File
The only noticeable difference was that Microsoft.Azure.Storage.DataMovement
supports .NET 4.5.2 and some difference in some of the calls.
I was wondering what the difference between these two libraries is?
What are the functionality that Microsoft.Azure.Storage.DataMovement
provide in addition to the normal Azure.Storage.Blobs
client?
And at last if switching the project from Azure.Storage.Blobs
to Microsoft.Azure.Storage.DataMovement
can improve the performance of blob uploads.
ANSWER
Answered 2020-Jun-05 at 21:58As it says in the GitHub description, the DataMovement
package mostly represents all operations which you can also do with the command line tool AzCopy.
This library is based on the core data movement framework that powers AzCopy.
You can find some examples of common DataMovement use cases here: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-data-movement-library
The most common use cases for me are transferring files between blob storage accounts or uploading files to an account without having to transfer them through your client. The base Azure.Storage.Blobs
library does not support any of that. There are more features, but those are my highlights.
So in your case, it can definitely improve the upload speed if your data can be transferred directly to the storage account without going through your web app. For other cases, it might still be slightly faster than whatever you are currently doing, but it is hard to say with the given information.
QUESTION
How do I write unit tests for classes that depend on Azure Table Storage, i.e. Microsoft.Azure.Cosmos.Table.CloudTableClient
?
I found this GitHub issue, Azure Storage is still hard to unit test / mock, but I didn't find any clues in it other than methods are now virtual
.
MyService
takes a dependency on CloudTableClient
and internally gets a reference to a CloudTable
to query the table. In my example here I'm doing a simple lookup by partition and row key:
ANSWER
Answered 2019-Nov-20 at 15:11- Create a mock for
CloudTable
- Override the
ExecuteAsync
behavior viaSetup
- Override the
- Create a mock for
CloudTableClient
- Override the
GetTableReference
behavior to return theCloudTable
mock viaSetup
- Override the
QUESTION
I've been having an issue with the Microsoft.WindowsAzure.Storage v9.3.3 and Microsoft.Azure.Storage.Blob v11.1.0 NuGet libraries. Specifically when download a large file. If you change your network during the "DownloadToStreamAsync" method the call hangs. I've been seeing my code, which processes a lot of files, hang occasionally and I've been trying to narrow it down. I think the network change might be a reliable way of triggering some failure in the Azure Blob Storage Libraries.
More info about the issue;
- When I unplug my network cable my computer switches to WiFi but the request never resumes
- If I start the download on WiFi and then plug in my network cable the same error occurs
- The “ServerTimeout” property never fails the request or acts as expected in accordance to the Documentation
- The “MaximumExecutionTime” property does fail the request but we don’t want to limit ourselves to a certain time period, especially because we’re dealing with large files
The following code fails 100% of the time if the network is changed during the call.
...ANSWER
Answered 2019-Nov-05 at 09:48Thanks to Mohit for the suggestion.
- Create a Task to check the stream length in the background
- If the stream hasn't increased in a set period of time, cancel the DownloadToStreamAsync
DISCLAIMER: I haven't written tests around this code or how to make it run in a performant way as you couldn't have a wait like this for every file you process. I might need to cancel the initial task if the download completes, I don't know yet, I just wanted to get it working first. I don't deem it production ready.
QUESTION
I've always found this very confusing. There is a WindowsAzure.Storage Nuget package authored by Microsoft which allows you to work with, for example, blob storage (creating blobs, etc.). There are also Microsoft.Azure.Storage.* packages which accomplish the same thing, also authored by Microsoft. If your project happens to have dependencies on both, you can have naming conflicts e.g. (The type 'CloudStorageAccount' exists in both 'Microsoft.Azure.Storage.Common, ... and 'Microsoft.WindowsAzure.Storage, ...).
Here are links to the two alternatives:
https://docs.microsoft.com/en-us/dotnet/api/overview/azure/storage?view=azure-dotnet
https://github.com/Azure/azure-storage-net/blob/master/README.md
What is the difference and when would I be motivated to use one over the other?
...ANSWER
Answered 2019-Jul-09 at 14:35WindowsAzure.Storage
(latest is v9.3.2) is the legacy Storage SDK we always use and Microsoft.Azure.Storage.*
(latest v9.4.0) is its new release, nuget available about one year.
Check the changelog of Storage .NET SDK. List part of those important differences/changes.
Microsoft.Azure.Storage
splits libraries to three parts, Blob, Queue and File, which means we can install separate package instead of the full edition.Microsoft.Azure.Storage
doesn't support Table API, it is transferred to Microsoft.Azure.Cosmos.Table.Microsoft.Azure.Storage
added NetStandard2.0 target support since 9.4.0-preview, which supports synchronous methods wrapped over the asynchronous APIs.WindowsAzure.Storage
on NetStandard only has asynchronous APIs.Microsoft.Azure.Storage
v9.4 package moves back to useMicrosoft.WindowsAzure.Storage
namespace temporarily to ease the transition for existing libraries.
Just make choices based on our requirement.
QUESTION
I'm trying to do the following code which doesn't compile:
...ANSWER
Answered 2018-Aug-06 at 04:55Storage SDK for .NET Framework and .NET Core has minor differences, which are not clarified in the docs.
Begin with v9.2.0, AddMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
method has been removed in .NET Core SDK. So one workaround is to downgrade sdk to v9.1.1.
Good news is that the differences will be eliminated in next version of Azure Storage Package. See related issue comment.
This library is set to target .NET Standard 2.0 and will not contain these minor API differences.
So another workaround is to use preview version before it becomes generally available.
Note that namespace is changed in preview version.
QUESTION
Just upgraded several Azure libraries and now Azure Data Movement (E.g. TransferManager) no longer works.
https://github.com/Azure/azure-storage-net-data-movement
Appears as though that package isn't using the latest changes from Microsoft.
...ANSWER
Answered 2019-May-09 at 07:14Update 5/9:
this issue is fixed on the latest version 0.11.0
This is due to the changes in the latest version 10.0.0 of Microsoft.Azure.Storage.Blob
or Microsoft.Azure.Storage.File
.
You can nav to the project site of Microsoft.Azure.Storage.Blob, now the namespace is changing to Microsoft.Azure.Storage.* (for blob, it's Microsoft.Azure.Storage.Blob):
But in Data Movement library, the method TransferManager.UploadAsync(myfile, destBlob)
is still refer to the type Microsoft.WindowsAzure.Storage.Blob.CloudBlob
, which is now not available in v10.0.0 of Microsoft.Azure.Storage.Blob
.
So in Data Movement library -> TransferManager.UploadAsync(), the parameter should be changed to Microsoft.Azure.Storage.Blob.CloudBlob
. Then it can work well.
I see you have submitted an issue, and the team will fix the issue in Data Movement library soon.
As of now, you can use the lower version of Blob or File, and wait for the fix release(I also submit a bug for this issue).
Hope it helps.
QUESTION
I'm attempting to write a simple object containing a collection, for example:
...ANSWER
Answered 2019-May-05 at 22:01Yes TableEntity.Flatten
in the SDK does not support ICollection/IEnumerable
type properties. But v2.0 of ObjectFlattener API here supports IEnumerable/ICollection etc. propoerties. https://www.nuget.org/packages/ObjectFlattenerRecomposer/
I put some usage example in the Nuget package description, it is very similar to using the TableEntity.Flatten/ConvertBack
api but with all property types being supported.
QUESTION
This is a follow-up question to this question:
How to delete a blob using Azure Functions?
When a blob triggers my Azure Function, I need to delete it once its processing is done. Otherwise, I will end up with many blobs in the container.
When I run the following code:
...ANSWER
Answered 2018-Oct-21 at 06:06Problem locates at this line
QUESTION
From the documentation of the function CloudBlobClient.StartCopyAsync()
It says
Initiates an asynchronous operation to start copying another block blob's contents, properties, and metadata to this block blob.
I hope to know if the function will return once the process is started, or completed. If the implementation of this function open-sourced?
It's a partial class here: https://github.com/Azure/azure-storage-net/blob/master/Lib/WindowsRuntime/Blob/CloudBlobClient.cs
...ANSWER
Answered 2018-Jun-15 at 22:30Internally, CloudBlockBlob.StartCopyAsync()
calls the Copy Blob REST API.
The function will return once the process is started:
In version 2012-02-12 and newer, the
Copy Blob
operation can complete asynchronously. This operation returns a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis.The source blob for a copy operation may be a block blob, an append blob, or a page blob, or a snapshot. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress.
In version 2015-02-21 and newer, the source for the copy operation may also be a file in the Azure File service. If the source is a file, the destination must be a block blob.
Below is the source code to proactively check copy status after calling CloudBlockBlob.StartCopyAsync()
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install azure-storage-net
NuGet packages for Blob, File, Queue
Azure Storage APIs for .NET
Quickstart for Blob, File, Queue
The Storage Client Libraries ship with the Microsoft Azure SDK for .NET and also on NuGet. You'll find the latest version and hotfixes on NuGet via the Microsoft.Azure.Storage.Blob, Microsoft.Azure.Storage.File, Microsoft.Azure.Storage.Queue, and Microsoft.Azure.Storage.Common packages.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page