【问题标题】:Unable to create container on Azure Storage无法在 Azure 存储上创建容器
【发布时间】:2015-04-01 04:26:04
【问题描述】:

我正在尝试使用以下简单代码创建天蓝色存储。

手动尝试交叉检查工作正常。

static void Main(string[] args)
{
    //Parse the connection string and return a reference to the storage account.
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

    //Create the blob client object.
    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

    //Get a reference to a container to use for the sample code, and create it if it does not exist.
    CloudBlobContainer container = blobClient.GetContainerReference("sascontainer");
    container.CreateIfNotExists();
}

出现错误:

Microsoft.WindowsAzure.Storage.dll 中出现“Microsoft.WindowsAzure.Storage.StorageException”类型的未处理异常 附加信息:远程服务器返回错误:(407) 需要代理身份验证。

App.config

  <appSettings>
    <add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=ashuthinks;AccountKey=MYKEY"/>
  </appSettings>

【问题讨论】:

  • 该错误表明您正坐在代理服务器后面。您需要配置代理设置(很可能在 app.config 文件中)。
  • 哪个代理设置:O你能帮我吗?
  • 更多帮助请见this

标签: c# azure azure-storage azure-blob-storage


【解决方案1】:

&lt;defaultProxy useDefaultCredentials="true" /&gt; 添加到您的配置文件中,如下所述。

<configuration> 
 <system.net> 
   <defaultProxy enabled="true" useDefaultCredentials="true"> 
    <proxy usesystemdefault="true" /> 
   </defaultProxy>
  </system.net>
<configuration>

【讨论】:

    猜你喜欢
    • 2011-02-24
    • 2018-11-21
    • 2019-11-03
    • 1970-01-01
    • 1970-01-01
    • 2013-02-23
    • 2013-06-01
    • 1970-01-01
    • 2021-01-21
    相关资源
    最近更新 更多