Google API:无法找到 Grpc.Core 类型。请确保您有合适的 Grpc.Core 依赖错误

问题描述 投票:0回答:1

在 ASP.NET Framework (4.7.2) 应用程序中使用 Google API .NET 客户端版本 4.4.0。

在我的开发电脑上一切都运行良好,但是当我将其传输到服务器后,当它尝试创建客户端时,我收到以下错误。

无法找到 Grpc.Core 类型。请确保您在 /_/Google.Api.Gax.Grpc/GrpcCoreAdapter.cs:line 64 中的 Google.Api.Gax.Grpc.GrpcCoreAdapter.CreateChannelFactory() 处具有合适的 Grpc.Core 依赖项

var client = new FirestoreClientBuilder();

我尝试寻找错误但没有成功。

我做过的事:

  1. 检查所有 Google 和 Grpc DLL 是否都在 bin 文件夹中
  2. 检查了 web.config 中的程序集引用
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
     <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.0.15.0" newVersion="2.0.15.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-1.64.0.0" newVersion="1.64.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-3.25.1.0" newVersion="3.25.1.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.Gax.Grpc" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.Gax" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.CommonProtos" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.13.0.0" newVersion="2.13.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Net.Http.WinHttpHandler" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
 </assemblyBinding>

我觉得要么是缺少文件,要么是 web.config 设置。感谢任何帮助。

google-api-dotnet-client
1个回答
0
投票

我能够找到该应用程序所需的丢失文件:

Grpc.Core.dll

located in packages\Grpc.Core.2.46.6\lib\net45

该文件未包含在 Web 应用程序的已发布文件中,可能是因为 Google API 客户端在 Web 应用程序引用的另一个项目中使用。

希望这对将来的人有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.