2016-03-28 32 views
1

我正在蔚藍工作,可以請你幫我如何將參數傳遞給存儲空間在天藍色。如何將參數傳遞給存儲Uri?

這裏他們有5個參數credientials,blob,隊列,表,文件 如何傳遞參數?請檢查下面的代碼。

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")); 
+0

有你想通過這些存儲URI參數的原因是什麼?從你的問題看,你似乎連接到標準的存儲端點。 –

+0

是的,當我們通過「DefaultEndpointsProtocol = https我們面臨一些問題,所以我們從StorageCredentialsAccountAndKey或StorageCredentials傳遞accntnt名稱和密鑰,以便它的需要終點,你可以幫我如何傳遞存儲參數 – stpdevi

回答

1

嘗試類似如下:

 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))) 
      ); 
+0

謝謝你的幫助 – stpdevi