【发布时间】:2018-10-09 18:51:16
【问题描述】:
我正在尝试将图像上传到 Blob。因此在 Web.Config 我有这样的设置:
<appSettings>
<add key="webpages:Enabled" value="false" />
<add key="StorageAccountName" value="storageaccount1"/>
<add key="StorageAccountKey" value="storageaccountkey1"/>
</appSettings>
这是它在门户中的样子:
我的点网代码如下:
public class ConnectionString
{
static string account = CloudConfigurationManager.GetSetting("StorageAccountName");
static string key = CloudConfigurationManager.GetSetting("StorageAccountKey");
public static CloudStorageAccount GetConnectionString()
{
string connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", account, key);
return CloudStorageAccount.Parse(connectionString);
}
}
但是,我的“帐户”和“密钥”变量返回 NULL。
任何人都可以建议,我做错了什么?有什么我遗漏的吗?
注意:我可以通过“Azure Storage Explorer”上传图片。
【问题讨论】:
-
问题是否发生在本地?在 Azure 上?您是否检查您的配置文件或门户应用程序设置刀片中是否有这些设置?
标签: azure azure-storage azure-blob-storage