误差示出在下载的dll误差、出在、dll

2023-09-05 03:18:20 作者:灵魂的所在

上午整合谷歌压延机使用谷歌API版本3,使用的NuGet包安装,包装Google.Apis.Calendar.v3 ,也指这个链接。在运行Web应用程序时收到错误为:

Am on integrating google calander using google api version 3, using NuGet package Install-Package Google.Apis.Calendar.v3 and also referring this link. while running the web application am getting the error as :

System.IO.FileLoadException **:无法加载文件或程序    System.Net.Http.Primitives ,版本= 2.2.22.0 ,文化=中立,   公钥= b03f5f7f11d50a3a或它的某一个依赖。该   位于集清单定义不大会匹配   参考。 (来自HRESULT的异常:0x80131040 的)--->    System.IO.FileLoadException :无法加载文件或程序集System.Net.Http.Primitives,版本= 1.5.0.0,文化=中立,   公钥= b03f5f7f11d50a3a或它的某一个依赖。该   位于集清单定义不大会匹配   参考。 (从HRESULT异常:0x80131040)

System.IO.FileLoadException**: Could not load file or assembly 'System.Net.Http.Primitives, Version=2.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

在网络配置文件正在使用此为:

the web config file am using for this is:

<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="2.2.22.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

包配置是这样的:

the package config is like :

<?xml version="1.0" encoding="utf-8"?>
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <package id="Google.Apis" version="1.9.0" targetFramework="net40" />
  <package id="Google.Apis.Auth" version="1.9.0" targetFramework="net40" />
  <package id="Google.Apis.Calendar.v3" version="1.9.0.1110" targetFramework="net40" />
  <package id="Google.Apis.Core" version="1.9.0" targetFramework="net40" />
  <package id="log4net" version="2.0.3" targetFramework="net40" />
  <package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
  <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
  <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
  <package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
  <package id="Zlib.Portable" version="1.10.0" targetFramework="net40" />
</packages>

bith是类似于在引用链接

更新:

---内部异常堆栈跟踪的结尾---在   Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务   任务)在   Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务   任务)在   Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务的任务)   在   Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable 1.ConfiguredTaskAwaiter.GetResult()   在   Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker&LT; AuthorizeAsync&GT; d__1.MoveNext()   在   c:\$c$c\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Auth.DotNet4\OAuth2\GoogleWebAuthorizationBroker.cs:line   内部异常堆栈跟踪59 - 完 - 在   System.Threading.Tasks.Task.ThrowIfExceptional(布尔   includeTaskCanceledExceptions)在   System.Threading.Tasks.Task 1.get_Result()在   testVB.home.Page_Load(对象发件人,EventArgs e)在   D:\ GoogleCalandarDemo \ testApp \ testVB \ home.aspx.vb:第26行

--- End of inner exception stack trace --- at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__1.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Auth.DotNet4\OAuth2\GoogleWebAuthorizationBroker.cs:line 59 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.get_Result() at testVB.home.Page_Load(Object sender, EventArgs e) in D:\GoogleCalandarDemo\testApp\testVB\home.aspx.vb:line 26

做,即意味着该错误是在 DLL 我是指?

does it means the error is in the dll i was referring?

推荐答案

有你的NuGet安装微软HTTP客户端库?这可能是这个问题。

Have you installed the "Microsoft Http Client Libraries" from Nuget? This might be the issue.

PM> Install-Package Microsoft.Net.Http