【发布时间】:2021-09-08 14:29:08
【问题描述】:
我有一个连接到 Azure blob 存储的 ASP.NET MVC 应用程序;在本地一切都很好,我可以连接到 blob 存储并访问我的容器并列出 blob,但是一旦部署我就会收到此错误:
Azure.RequestFailedException:无法解析远程名称:'MyAccountName.blob.core.windows.net'
有人知道如何解决这个错误吗?
这是连接到 Azure Blob 的容器代码
public ActionResult QuickPhotos()
{
string storageConnectionString = ConfigurationManager.ConnectionStrings["AZURE_STORAGE_CONNECTIONSTRING"].ConnectionString;
string containerName = "infoimages";
BlobContainerClient blobContainerClient = new BlobContainerClient(storageConnectionString, containerName);
List<string> Images = new List<string>();
foreach (BlobItem item in blobContainerClient.GetBlobs())
{
Images.Add("https://azureblob.interstellarseries.com/" + containerName +"/"+item.Name);
}
return View(Images);
}
【问题讨论】:
-
你能分享你关于连接到 blob 存储的代码吗?
-
@PamelaPeng 用代码更新问题,抱歉回复晚了
标签: asp.net-mvc azure-blob-storage