Azure Storage Library Client on Windows 10 Iot/UWP?

梦想的初衷 提交于 2019-12-13 15:40:21

问题


It appears that the Azure Storage Client is not supported on Windows 10 Iot-Core/UWP (RPi). However, I am using it for Blobs, and it also used to work fine for Tables. Now, after an update to the latest stable (and -pre, tried both) the access to Tables hangs at

await table.ExecuteQuerySegmentedAsync(query, new TableContinuationToken());

I searched in vain for a way to make this synchronous, which would, at the least, help me debug it. I also am wondering about the current success of others and the "scoop" on using the Azure Storage Client on IoT-Core (RPi).

UPDATE: Extended the RequestOptions as below and my simple call also shown below. I double checked the connection string, the table access (from other tools) and the account. All of them work fine from other places. I've also pasted the exceptions I get in VStudio2015 remote debugging to IoT-Core RaspberryPi latest version.

        // Setup the table container
        // connectString looks fine, works fine elsewhere: http for debug instead of https 
        var connectionString = @"DefaultEndpointsProtocol=http;AccountName=myaccount;AccountKey=EUybijab+WHATEVERDzYubKGADwjf/6k5IuoRVgPMMqMez0gb07/dfAv9Qj1/v7NkstGAygWNab07q6FhNBQ==";

        var cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
        CloudTableClient cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
        cloudTable = cloudTableClient.GetTableReference(appSettings.AzureStorageOeConfigTableName);
        //never returns var x = await cloudTable.CreateIfNotExistsAsync();

        // Simplest query to existing small table
        var pkey = "b8-27-eb-86-5d-4d";
        var rkey = "0000000013505717";
        var tstOp = TableOperation.Retrieve(pkey, rkey);
        var requestOptions = new TableRequestOptions
        {
            PayloadFormat = TablePayloadFormat.JsonFullMetadata,
            LocationMode = LocationMode.PrimaryThenSecondary,
            RetryPolicy = new ExponentialRetry(),
            ServerTimeout = TimeSpan.FromMinutes(2)
        };
        // Throws exceptions shown below.
        var tst1 = await table.ExecuteAsync(tstOp, requestOptions, null);

Exceptions: Any ideas or modifications to my test code?

{"<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<!--An exception has occurred. For more information please deserialize this message via RequestResult.TranslateFromExceptionMessage.-->\r\n<RequestResult>\r\n  <HTTPStatusCode>403</HTTPStatusCode>\r\n  <HttpStatusMessage>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.</HttpStatusMessage>\r\n  <TargetLocation>Primary</TargetLocation>\r\n  <ServiceRequestID>c4892c5a-0002-003a-4992-493991000000</ServiceRequestID>\r\n  <ContentMd5 />\r\n  <Etag />\r\n  <RequestDate>Wed, 06 Jan 2016 22:30:01 GMT</RequestDate>\r\n  <StartTime>Wed, 06 Jan 2016 21:29:55 GMT</StartTime>\r\n  <EndTime>Wed, 06 Jan 2016 21:32:12 GMT</EndTime>\r\n  <Error>\r\n    <Code>AuthenticationFailed</Code>\r\n    <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\r\nRequestId:c4892c5a-0002-003a-4992-493991000000\r\nTime:2016-01-07T21:30:36.1204037Z</Message>\r\n  </Error>\r\n  <ExceptionInfo>\r\n    <Type>StorageException</Type>\r\n    <HResult>-2147467259</HResult>\r\n    <Message>Cannot access a closed Stream.</Message>\r\n    <Source />\r\n    <StackTrace />\r\n    <InnerExceptionInfo>\r\n      <ExceptionInfo>\r\n        <Type>ObjectDisposedException</Type>\r\n        <HResult>-2146232798</HResult>\r\n        <Message>Cannot access a closed Stream.</Message>\r\n        <Source>mscorlib</Source>\r\n        <StackTrace>   at System.IO.__Error.StreamIsClosed()\r\n   at System.IO.BufferedStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)\r\n   at System.Net.Http.DelegatingStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)\r\n   at Microsoft.WindowsAzure.Storage.Core.Util.StreamExtensions.&lt;WriteToAsync&gt;d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.&lt;ExecuteAsyncInternal&gt;d__c`1.MoveNext()</StackTrace>\r\n      </ExceptionInfo>\r\n    </InnerExceptionInfo>\r\n  </ExceptionInfo>\r\n</RequestResult>"}

回答1:


Yes, unfortunately UWP apps are not supported yet by Storage, as there's a bug in the UWP platform that causes problems with Auth. We are waiting on a fix from the UWP team. Thanks!



来源:https://stackoverflow.com/questions/34594757/azure-storage-library-client-on-windows-10-iot-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!