2016-03-28 19 views
1

私は紺碧に取り組んでいます。紺色のstorageUriにパラメータを渡す方法を教えてください。パラメータをストレージに渡す方法Uri?

ここには5つのパラメータcredientials、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")); 
+0

あなたはこれらのストレージURIパラメータを渡す理由はありますか?あなたの質問から、標準のストレージエンドポイントに接続しているようです。 –

+0

yes「DefaultEndpointsProtocol = https」を渡しているときに、StorageCredentialsAccountAndKeyまたはStorageCredentialsからaccntntの名前とキーを渡しているので、必要なエンドポイントについては、storageuriパラメータを渡す方法を教えてください。 – 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

関連する問題