asp.net - 在 Mac 上使用 Azure 存储与 ASP.NET vNext

标签 asp.net macos azure mono asp.net-core

尝试从 Mac 上的 MVC 6 应用程序中的 Azure TableStorage 读取数据。 它可以在 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> 

遵循此discussion后并安装System.Net.Http包使用 kpm我开始收到一个新错误:

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 

注意: 我有System.Net.Http软件包安装在 "aspnetcore50": { "dependencies": { ... } } ,但似乎必须安装在公共(public) dependencies

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

最佳答案

您无法在 aspnetcore50 下使用 Azure 存储 .NET 客户端,它不适用于此运行时。您需要将其拉到 aspnet50 下(现在 dnx451)。

关于asp.net - 在 Mac 上使用 Azure 存储与 ASP.NET vNext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28489167/

相关文章:

asp.net - azure 中多个 Web 服务器上的用户身份验证

asp.net - FormsAuthentication.Initialize() 的作用是什么?

asp.net - MVC 3 ASPX VS RAZOR View 引擎

c++ - 为什么我无法输入文件中的整数?

c++ - 在 OSX 上安装 SDL

c# - Azure管道找不到 Selenium 测试

c# - Azure 事件中心 : Send Async performance

c# - 在共享主机上使用 SQL Server 数据库

angularjs - 如何将纯 Angular 应用程序从 Visual Studio Team System 部署到 Azure 网站

cocoa - OpenGL像素格式属性(NSOpenGLPixelFormatAttibutes)解释?