首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Xamarin移动应用程序中显示存储在Azure-storage中的斑点/照片

在Xamarin移动应用程序中显示存储在Azure-storage中的斑点/照片
EN

Stack Overflow用户
提问于 2019-05-30 08:35:41
回答 2查看 464关注 0票数 1

尝试开发一个Xamarin Forms移动应用程序,该应用程序通过api显示存储在Azure-Storage容器中的blobs。

当前流程如下: API > Azure-Storage Blob >显示在Xamarin移动应用程序中。

使用存储帐户密钥连接到azure存储。

问题是,当容器上的公共访问设置为“private”时,blob不会显示在移动应用程序中。如果容器公共访问设置为“blob”,则照片将显示在xamarin Mobile应用程序中。

图片用于说明目的。Photo of issue

代码如下。

代码语言:javascript
复制
string storageConnectionString 
Environment.GetEnvironmentVariable("storageconnectionstring");

CloudStorageAccount storageAccount;
if (CloudStorageAccount.TryParse(storageConnectionString, out 
storageAccount))
{
// If the connection string is valid, proceed with operations against 
Blob storage here.
...
}
else
{
//Error
}
[enter image description here][1]CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();

如何将容器设置为私有,同时仍然在移动应用程序中显示blob?

EN

回答 2

Stack Overflow用户

发布于 2019-05-30 09:32:11

我认为你可能使用了错误的Azure blob存储连接。

您需要使用共享密钥。

shared key authentication with azure blob storage

您将需要生成新的共享访问签名。

create a new SAS

我希望这为您指明了正确的方向。

票数 0
EN

Stack Overflow用户

发布于 2019-05-31 06:49:09

非常感谢您的帮助@justjoshin。

SAS就是答案。在那里,您可以生成一个SAS令牌,将其附加在blob url之后以显示它,即使容器是私有的也是如此。

希望这对任何人都有帮助。

最好的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56370197

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档