由于 xamarin,我目前正在编写一个针对多个平台的应用程序。PCL 中的应用程序逻辑,我使用 WPF 应用程序作为前端来测试 PCL。我需要使用驻留在 PCL 中的以下代码连接到我的 BLOB 存储帐户,该帐户可以在 WPF 应用程序中完美运行:
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 Microsoft.WindowsAzure.Storage.DLL 中出现“System.IO.FileNotFoundException”类型的第一次机会异常无法加载文件或程序集“系统,版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”或其依赖项之一。该系统找不到指定的文件。
在 Microsoft.WindowsAzure.Storage.CloudStorageAccount.ParseImpl(String connectionString, CloudStorageAccount& accountInformation, Action`1 错误) 在 Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(String connectionString) 在 APXClient.PCL.AirproxClient.ConnectBlobStorage()
帮助将不胜感激!