无法在.NET AWSSDK中为单声道加载文件或程序集“System.Net.Http.Webrequest”

时间:2014-04-18 19:46:08

标签: amazon-web-services mono x86

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

但是现在在目标机器上我看到代码抛出异常试图解析System.Net.Http.Webrequest,它应该存在并在Mono中得到支持。我甚至尝试从Git中提取AWSSDK代码并在Xamarin中构建,并且构建良好,但在运行时我的代码无法解析AWS SDK调用中的依赖关系。

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。

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

1 个答案:

答案 0 :(得分:0)

我有类似的错误,但它是“System.Net.Http.Primitives”: 为了修复它,我回滚了AWSSDK版本直到它工作,在我的情况下3.1.10。 这可以使用Visual Studio中的NuGet包管理器完成 工具 - &gt; Nuget包管理器 - &gt;管理解决方案的Nuget包, 然后选择“已安装”,然后选择包。 更改右侧的版本号,然后单击“安装”。 希望这会有所帮助!!!