无法在 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();
}
获取错误:
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>
将 <defaultProxy useDefaultCredentials="true" />
添加到您的配置文件中,说明如下。
<configuration>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="true" />
</defaultProxy>
</system.net>
<configuration>
我正在尝试使用以下简单代码创建 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();
}
获取错误:
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>
将 <defaultProxy useDefaultCredentials="true" />
添加到您的配置文件中,说明如下。
<configuration>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="true" />
</defaultProxy>
</system.net>
<configuration>