繁体   English   中英

无法在Azure存储上创建容器

[英]Unable to create container on Azure Storage

我正在尝试使用下面的简单代码创建azure存储。

手动尝试进行交叉检查,可以手动正常运行。

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>

<defaultProxy useDefaultCredentials="true" />添加到您的配置文件中,如下所述。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM