简体   繁体   中英

Unable to create container on Azure Storage

I'm trying to create azure storage using follwing simple code.

Tried manually for cross check working fine manually.

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();
}

getting error :

An unhandled exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll Additional information: The remote server returned an error: (407) Proxy Authentication Required.

App.config

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

Add <defaultProxy useDefaultCredentials="true" /> in to your configuration file explained below.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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