I'm trying to connect web and worker role. So i have a page where user can upload video files. Files are large so i can't use the query to send files. That's why i'm trying to upload them into the Blob Storage and then send the url by the query. But i don't know how to get this url.
Can anyone help me?
Assuming you're uploading the blobs into blob storage using .Net storage client library by creating an instance of CloudBlockBlob, you can get the URL of the blob by reading Uri property of the blob.
static void BlobUrl()
{
var account = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
var cloudBlobClient = account.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference("container-name");
var blob = container.GetBlockBlobReference("image.png");
blob.UploadFromFile("File Path ....");//Upload file....
var blobUrl = blob.Uri.AbsoluteUri;
}
The above solution is perfect you just have to add the below code to get the url of Image.
static void BlobUrl()
{
var account = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
var cloudBlobClient = account.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference("container-name");
var blob = container.GetBlockBlobReference("image.png");
blob.UploadFromFile("File Path ....");//Upload file....
string blobUrl = blob.Uri.AbsoluteUri;
}
This string -> blobUrl will give you the url of blob to get the image.
来源:https://stackoverflow.com/questions/16961933/how-to-get-blob-url-after-file-upload-in-azure