現在、xamarin のおかげで複数のプラットフォームを対象とするアプリを作成しています。アプリのロジックは PCL にあり、WPF アプリをフロントエンドとして使用して PCL をテストしています。PCL にある次のコードを使用して、WPF アプリから完全に機能する BLOB ストレージ アカウントに接続する必要があります。
bool connected = false;
int attempts = 0;
while (!connected)
{
try
{
Debug.WriteLine("CLIENT | Connecting to Storage try " + (attempts + 1).ToString());
// Retrieve storage account from connection string.
storageAccount = CloudStorageAccount.Parse(TechnicalData._BLOBCONNECTIONSTRING);
// Create the blob client.
blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
blobContainer = blobClient.GetContainerReference(TechnicalData._BLOBCONTAINERFLIGHTLOGS);
// Create the container if it doesn't already exist.
blobContainer.CreateIfNotExists();
connected = true;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
Debug.WriteLine(ex.InnerException);
Debug.WriteLine(ex.StackTrace);
attempts++;
connected = false;
}
}
ただし、WP8 アプリから使用すると、次のエラーが発生します。
クライアント | クライアント | ストレージへの接続試行 21 型 'System.IO.FileNotFoundException' の初回例外が Microsoft.WindowsAzure.Storage.DLL で発生しました ファイルまたはアセンブリ 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' を読み込めませんでしたまたはその依存関係の 1 つ。システムは、指定されたファイルを見つけることができません。
Microsoft.WindowsAzure.Storage.CloudStorageAccount.ParseImpl (文字列 connectionString、CloudStorageAccount& accountInformation、Action`1 エラー) で Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse (文字列 connectionString) で APXClient.PCL.AirproxClient.ConnectBlobStorage()
助けていただければ幸いです。