无法加载文件或程序集"System.Net.Http.Webrequest";在.NET AWSSDK中用于单声道 [英] Could not load file or assembly "System.Net.Http.Webrequest" in .NET AWSSDK for mono

查看:221
本文介绍了无法加载文件或程序集"System.Net.Http.Webrequest";在.NET AWSSDK中用于单声道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Mono中恢复了一个我们已经有一段时间没有使用的项目.我做的第一件事就是升级共享代码,其中包含适用于.NET nuget软件包的AWSSDK(版本2.0.11).我们对Nuget软件包的版本也进行了更新.

I recently revived a project in Mono we haven't used in a while. One of the first things I did was upgrade our shared code, which contained the AWSSDK for .NET nuget package (on version 2.0.11). Our version of the Nuget package was also updated.

但是现在我在目标计算机上看到代码抛出异常,试图解析System.Net.Http.Webrequest,该异常应该存在并在Mono中受支持.我什至尝试从Git中提取AWSSDK代码并在Xamarin中进行构建,并且构建良好,但是在运行时,我的代码无法解决AWS开发工具包调用中的依赖关系.

However now on the target machine I'm seeing the code throw an exception trying to resolve System.Net.Http.Webrequest, which should exist and be supported in Mono. I even tried pulling the AWSSDK code from Git and building in Xamarin, and it builds fine, but at runtime my code fails to resolve the dependency inside the AWS SDK call.

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  at Amazon.Runtime.AmazonWebServiceClient.Initialize () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.AbstractWebServiceClient..ctor (Amazon.Runtime.AWSCredentials credentials, Amazon.Runtime.ClientConfig config, AuthenticationTypes authenticationType) [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.AmazonWebServiceClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.Runtime.ClientConfig config, AuthenticationTypes authenticationType) [0x00000] in <filename unknown>:0 
  at Amazon.S3.AmazonS3Client..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.S3.AmazonS3Config clientConfig) [0x00000] in <filename unknown>:0 
  at Core.Amazon.S3.S3File..ctor () [0x00000] in <filename unknown>:0 
  at LitmusMono.WebmailMonoTestingService..ctor () [0x00000] in <filename unknown>:0 
  at LitmusMono.ServiceStarter.InitTestingServices () [0x00000] in <filename unknown>:0 
Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

  at Amazon.Runtime.AmazonWebServiceClient.Initialize () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.AbstractWebServiceClient..ctor (Amazon.Runtime.AWSCredentials credentials, Amazon.Runtime.ClientConfig config, AuthenticationTypes authenticationType) [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.AmazonWebServiceClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.Runtime.ClientConfig config, AuthenticationTypes authenticationType) [0x00000] in <filename unknown>:0 
  at Amazon.S3.AmazonS3Client..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.S3.AmazonS3Config clientConfig) [0x00000] in <filename unknown>:0 

一些注意事项:我正在使用的发行版配置强制执行x86构建,因为我的一个子项目是x86.

Some notes: The release configuration I'm using is forcing x86 build because one of my child projects is x86.

要运行的程序的目标平台是带有Mono 3.0.4 beta的OSX.

The target platform for the program to run is OSX with Mono 3.0.4 beta.

推荐答案

我遇到了类似的错误,但它是"System.Net.Http.Primitives": 为了解决该问题,我回退了AWSSDK版本,直到它正常工作为止(以我的情况为3.1.10). 这可以使用Visual Studio中的NuGet程序包管理器来完成 工具-> Nuget软件包管理器->管理解决方案的Nuget软件包, 然后选择已安装",然后选择软件包. 更改右侧的版本号,然后单击安装. 希望这会有所帮助!

I had a similar error but it was "System.Net.Http.Primitives": To fix it I rolled back the AWSSDK version until it worked, in my case 3.1.10. This can be done using the NuGet Package Manager in Visual Studio Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution, then select "Installed" and then the package. Change the version number on the right hand side then click install. Hope this helps!!!

这篇关于无法加载文件或程序集"System.Net.Http.Webrequest";在.NET AWSSDK中用于单声道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆