由于xamarin,我目前正在编写一款针对多个平台的应用。 应用程序的逻辑在PCL中,我使用WPF应用程序作为测试PCL的前端。 我需要连接到我的BLOB存储帐户,该帐户在WPF应用程序中运行良好,并且以下代码驻留在PCL中:
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”类型的第一次机会异常 无法加载文件或程序集'System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一。系统找不到指定的文件。
at Microsoft.WindowsAzure.Storage.CloudStorageAccount.ParseImpl(String connectionString,CloudStorageAccount& accountInformation,Action`1 error) 在Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(String connectionString) at APXClient.PCL.AirproxClient.ConnectBlobStorage()
非常感谢帮助!