I've developed a simple app, which just have to upload files from a folder to Azure Blob Storage, I runs fine when I run in from VS, but in the published app I get this error once in a while:
ved System.IO.__Error.WinIOError(Int32 errorCode, String, maybeFullPath) ved System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) ved System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) ved Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromFile(String path, FileMode mode, AccessCondition accessCondition, BlobRequestOptions options, OperationsContext operationContext) ved Program.MainWindow.Process(object sender, NotifyCollectionChangedEventArgs e)
My code for uploading looks like this:
private void Process(object sender, NotifyCollectionChangedEventArgs e)
{
if (paths.Count > 0){
var currentPath = paths.Dequeue();
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(UserSettings.Instance.getConnectionString());
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference(UserSettings.Instance.getContainer());
CloudBlockBlob b = blobContainer.GetBlockBlobReference(System.IO.Path.GetFileName(currentPath));
try
{
b.UploadFromFile(currentPath, FileMode.Open);
}
catch (StorageException s)
{
throw new System.InvalidOperationException("Could not connect to the specified storage account. Please check the configuration.");
}
catch (IOException exc)
{
throw new System.InvalidOperationException(exc.StackTrace);
}
}
}
It is the IOException in the catch that gets hit once in a while, any idea how to fix this?
If I go through the docs, I just get informed that the exception occour if a storage service error occoured. Any idea how to investigate the further?