我正在开发 azure,请帮我看看如何将参数传递给 azure 中的 storageUri。
这里有 5 个参数:credentials、blob、queue、table、file 如何传递参数storageuri?请检查下面的代码。
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)))
);
关于azure - 如何将参数传递给存储Uri?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36263336/