首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在运行RaspberryPi Win10 IOT内核的UWP应用程序中集成防火墙?

如何在运行RaspberryPi Win10 IOT内核的UWP应用程序中集成防火墙?
EN

Stack Overflow用户
提问于 2020-11-15 15:38:14
回答 1查看 285关注 0票数 0

我需要将Firebase的防火墙功能添加到我的应用程序(后台UWP应用程序)中,该应用程序运行在运行Windows 10 IOT Core的raspberry (ARM)上。

我设法让这个应用程序在我的电脑上完全正常工作(里面有火药库),并将它部署到树莓上,但当应用程序启动时,我得到了一个错误:

代码语言:javascript
复制
Error: Value cannot be null. Parameter name: path1 
    at System.IO.Path.Combine(String, String) + 0x2c
    at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary() + 0x36
    at Grpc.Core.Internal.NativeExtension.LoadNativeMethods() + 0x28
    at Grpc.Core.Internal.NativeExtension..ctor() + 0x12
    at Grpc.Core.Internal.NativeExtension.Get() + 0x4a
    at Grpc.Core.GrpcEnvironment.GrpcNativeInit() + 0x48
    at Grpc.Core.GrpcEnvironment..ctor() + 0x64
    at Grpc.Core.GrpcEnvironment.AddRef() + 0x54
    at Grpc.Core.Channel..ctor(String, ChannelCredentials, IEnumerable`1) + 0xa8
    at Google.Api.Gax.Grpc.GrpcCore.GrpcCoreAdapter.CreateChannelImpl(String, ChannelCredentials, GrpcChannelOptions) + 0x24
    at Google.Api.Gax.Grpc.GrpcAdapter.CreateChannel(String, ChannelCredentials, GrpcChannelOptions) + 0x16
    at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter, String, GrpcChannelOptions, ChannelCredentials) + 0x58
    at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter, String, GrpcChannelOptions) + 0x1a8
    at Google.Api.Gax.Grpc.ClientBuilderBase`1.CreateCallInvoker() + 0x5e
    at Google.Cloud.Firestore.V1.FirestoreClientBuilder.BuildImpl() + 0x16
    at Google.Cloud.Firestore.FirestoreDbBuilder.Build() + 0x1ee
    at Google.Cloud.Firestore.FirestoreDb.Create(String, FirestoreClient) + 0x1bc
    at Processing.Service.Firestore.<Initialize>d__22.MoveNext() + 0xc4

我尝试取消检查“使用.net原生工具链编译”项目选项,但现在我得到了以下错误:

代码语言:javascript
复制
Error loading native library "C:\Data\Programs\WindowsApps\Service_1.1.94.0_arm\grpc_csharp_ext.x86.dll".
    at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
    at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary()
    at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
    ...
    at Google.Cloud.Firestore.V1.FirestoreClientBuilder.BuildImpl()
    at Google.Cloud.Firestore.FirestoreDbBuilder.Build()
    at Google.Cloud.Firestore.FirestoreDb.Create(String projectId, FirestoreClient client)

在这两种情况下,我收到了224条警告:

代码语言:javascript
复制
    ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x64.dll' with unexpected CPU architecture 'amd64', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture.  Service         
    ILTransform : warning ILT0028: Found native library 'W:\Service\obj\ARM\Release\ilc\in\grpc_csharp_ext.x86.dll' with unexpected CPU architecture 'x86', while the current build target architecture is set to 'arm'. Your application may fail to launch. Please make sure to build your application with the matching CPU architecture.    Service         
    MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_convert_clock_type' for method 'Grpc.Core.Internal.Timespec     Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_convert_clock_type(Grpc.Core.Internal.Timespec, Grpc.Core.Internal.ClockType)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.  Service         
    MCG : warning MCG0007: Unresolved P/Invoke method 'grpc_csharp_ext!gprsharp_free' for method 'System.Void Grpc.Core.Internal.NativeMethods.DllImportsFromSharedLib.gprsharp_free(System.IntPtr)'.                                                                                         Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.  Service         

备注:

设备上存在json配置文件和所需的环境变量。使用Windows10IOTCore和UWP应用程序使用“application”(*.appxbundle)

  • I'm在设备上部署

  • ,因为这是我成功地使应用程序在覆盆子上工作的第一种方式,如果代码停留在C#中,则可以更改。

我试过:

project.

  • Updating "Google.Cloud.Firestore“nuget to "v2.3.0-beta1"

  • 添加"LibGrpc.Arm”和"libgrpc_csharp_ext.arm7“

想法:

Google.Cloud.Firestore

  • Using

  • 为ARM重新构建GRPC (如果可能的话),它会生成dll

  • 另一个Firestore (即: Xamarin)而不是Google.Cloud.Firestore

  • Using另一个Firebase SDK (即: Web或Unity)

  • ,而不是在raspbian上运行这个C#服务(如果可能的话),而不是获得10 IOT (尝试过,相同的error...)

  • Use Firebase RPC API直接使用

)

我需要建议,建议,想法.如果有人能帮忙的话,那就太棒了!

谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-11-23 15:10:27

问题在于,您正试图在基于ARM的平台上使用Grpc.Core。Grpc.Core在内部依赖于本机库(grpc_csharp_ext),而Grpc.Core包并没有提供该库的ARM构建版本,因此您所要做的工作将无法实现。

你能做的是:

  • 尝试使用grpc-dotnet (Grpc.Net.Client,https://github.com/grpc/grpc-dotnet),它没有本机组件,因此即使在基于ARM的覆盆子上也能很好地工作。
  • 您可以尝试自己编译grpc_csharp_ext到目标ARM,虽然这是完全可行的,但它是相当复杂的,所以我建议不要走这条路线。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64846353

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档