通过ASP.NET vNext在Mac上使用Azure存储

通过ASP.NET vNext在Mac上使用Azure存储,asp.net,macos,azure,mono,asp.net-core,Asp.net,Macos,Azure,Mono,Asp.net Core,正在尝试从Mac上的MVC 6应用程序中的Azure表存储读取数据。 它在PC上工作,但在Mac上时,它通常会出现以下错误: TypeLoadException: Could not load type 'Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand`1[Microsoft.WindowsAzure.Storage.Table.TableResult]' from assembly 'Microsoft.WindowsAzure

正在尝试从Mac上的MVC 6应用程序中的Azure表存储读取数据。 它在PC上工作,但在Mac上时,它通常会出现以下错误:

TypeLoadException: Could not load type 'Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand`1[Microsoft.WindowsAzure.Storage.Table.TableResult]' from assembly 'Microsoft.WindowsAzure.Storage, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'.
Microsoft.WindowsAzure.Storage.Table.TableOperation.ExecuteAsync (Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, System.String tableName, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext, CancellationToken cancellationToken) [0x00000] in <filename unknown>, line 0Stack Query Cookies Headers Environment
TypeLoadException: Could not load type 'Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand`1[Microsoft.WindowsAzure.Storage.Table.TableResult]' from assembly 'Microsoft.WindowsAzure.Storage, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'.
Microsoft.WindowsAzure.Storage.Table.TableOperation.ExecuteAsync (Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, System.String tableName, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext, CancellationToken cancellationToken) [0x00000] in <filename unknown>
Microsoft.WindowsAzure.Storage.Table.CloudTableClient.ExecuteAsync (System.String tableName, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext, CancellationToken cancellationToken) [0x00000] in <filename unknown>
Microsoft.WindowsAzure.Storage.Table.CloudTable+<>c__DisplayClass4+<<ExistsAsync>b__5>d__0.MoveNext () [0x00000] in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter`1[System.Boolean].GetResult () [0x00000] in <filename unknown> 
注意: 我把
System.Net.Http
包安装在
“aspnetcore50”:{“dependencies”:{…}
,但它似乎必须安装在公共
dependencies


你知道为什么会发生这种情况以及如何解决吗?

你不能在
aspnetcore50
下使用Azure Storage.NET客户端,它在此运行时不可用。您需要将它放到
aspnet50
dnx451
现在)下。

我对azure存储以及stackexchange.redis也有同样的疑问。我认为azure的问题在于它依赖于传统的HttpClient实现,而传统的HttpClient实现似乎依赖于本机win32 API。aspnet vnext存储库中有一个新的托管实现,但我现在还不知道如何使用它。恐怕我们必须等待并更新针对核心clr的azure sdk。这仍然是一个非常早期的预览,很多东西似乎缺失了,没有按照预期工作,或者只是没有记录/很难理解是的,这是一个非常早期的构建,但是我仍然想尝试调查这个问题。谁知道呢,也许有人想出了绕过它的办法。
An unhandled exception occurred while processing the request.NullReferenceException: Object reference not set to an instance of an object
Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpClientFactory.BuildHttpClient[TableResult] (Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand`1 cmd, System.Net.Http.HttpMessageHandler handler, Boolean useVersionHeader, Microsoft.WindowsAzure.Storage.OperationContext operationContext) [0x00000] in <filename unknown>, line 0