Azure 如何将参数传递到存储Uri?
我正在azure上工作,请您帮助我如何将参数传递到azure中的storageUri 这里有5个参数credientials,blob,queue,table,file 如何传递参数storageuri?请检查下面的代码Azure 如何将参数传递到存储Uri?,azure,c#-4.0,Azure,C# 4.0,我正在azure上工作,请您帮助我如何将参数传递到azure中的storageUri 这里有5个参数credientials,blob,queue,table,file 如何传递参数storageuri?请检查下面的代码 enter code here Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = null; string AccountName = RoleEnvironm
enter code here
Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = null;
string AccountName = RoleEnvironment.GetConfigurationSettingValue("AccountName");
string AccountKey = RoleEnvironment.GetConfigurationSettingValue("AccountKey");
StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(AccountName, AccountKey);
storageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(credentials,
new StorageUri(),
new StorageUri("https://{0}.queue.core.windows.net"),
new StorageUri("https://{0}.table.core.windows.net"),
new StorageUri("https://{0}.table.core.windows.net"));
请尝试以下操作:
var credentials = new StorageCredentials(accountName, accountKey);
CloudStorageAccount storageAccount = new CloudStorageAccount(credentials,
new StorageUri(new Uri(string.Format("https://{0}.blob.core.windows.net", accountName))),
new StorageUri(new Uri(string.Format("https://{0}.queue.core.windows.net", accountName))),
new StorageUri(new Uri(string.Format("https://{0}.table.core.windows.net", accountName))),
new StorageUri(new Uri(string.Format("https://{0}.file.core.windows.net", accountName)))
);
您希望传递这些存储URI参数的原因是什么?从您的问题来看,您似乎正在连接到标准存储端点。是的,当我们传递“DefaultEndpointsProtocol=https”时,我们面临一些问题,因此我们正在传递StorageCredentialsAccountAndKey或StorageCredentials中的帐户名和密钥,因此对于其需要的端点,您可以帮助我如何传递storageuri参数吗