Parallel Blob Upload throwing 404 Bad Request intermittently

后端 未结 2 1456
时光取名叫无心
时光取名叫无心 2020-12-18 01:28

I have a very simple service,

public class AzureService : IAzureService
{
    private readonly CloudBlobContainer _container;
    public AzureService(ISettin         


        
2条回答
  •  粉色の甜心
    2020-12-18 01:42

    The behaviour you are describing sounds very much like a threading problem (i.e. if you breakpoint the code it works fine as it's effectively single-threaded at that time) resulting in incomplete or invalid data being sent to the Azure Storage API.

    Your "var image" definition may behave unexpectedly in a multi-threaded environment (If you utilised ReSharper it will highlight this variable and advise to change the code because it is potentially unsafe).

    Have a read of this SO post to understand a little more and how you might better implement your code.

    The foreach identifier and closures

提交回复
热议问题