我正在尝试使用以下简单代码创建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>
答案 0 :(得分:3)
将<defaultProxy useDefaultCredentials="true" />
添加到您在下面说明的配置文件中。
<configuration>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="true" />
</defaultProxy>
</system.net>
<configuration>