407 Proxy error while creating container in 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>

Solution >

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>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s