[英]Azure Blob Storage (Development Connection Issue)
I have started implementing the Azure Blob storage into my application and when using the development connection string ("UseDevelopmentStorage=true;") it unfortunately fails when trying to create the container here: 我已经开始在应用程序中实现Azure Blob存储,使用开发连接字符串(“ UseDevelopmentStorage = true;”)时,不幸的是,在此处尝试创建容器时失败:
The exception is: Microsoft.WindowsAzure.Storage.StorageException was unhandled by user code InnerException: Message=An error occurred while sending the request. 例外是: 用户代码InnerException未处理Microsoft.WindowsAzure.Storage.StorageException:Message =发送请求时发生错误。 Source=System.Private.CoreLib InnerException: HResult=-2147012867 Message=A connection with the server could not be established Source=System.Private.CoreLib ....
Source = System.Private.CoreLib InnerException:HResult = -2147012867消息=无法建立与服务器的连接Source = System.Private.CoreLib...。
My code: 我的代码:
public async void UploadBlob(IFormFile file, string containerReference, string blobReference)
{
var container = _blobClient.GetContainerReference(containerReference);
await container.CreateIfNotExistsAsync();
var blockBlob = container.GetBlockBlobReference(blobReference);
using (var fileStream = file.OpenReadStream())
{
await blockBlob.UploadFromStreamAsync(fileStream);
}
}
Any ideas why I would not be able to connect? 有什么想法为什么我无法连接?
Thanks, Nik 谢谢,尼克
I had to start the local storage emulator, which I have totally overseen in the tutorial that I looked at. 我必须启动本地存储仿真器,在我看过的教程中已经完全监督了该仿真器。 Thank you for your tip Kenneth!
谢谢您的小费肯尼斯!
See here: https://azure.microsoft.com/en-us/documentation/articles/storage-use-emulator/#authenticating-requests-against-the-storage-emulator 请参阅此处: https : //azure.microsoft.com/zh-cn/documentation/articles/storage-use-emulator/#authenticating-requests-against-the-storage-emulator
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.