我正在开发一个使用gRPC库的ASP.NET Wep API应用程序。在Windows上它工作正常,但如果它在带有Apache和mod_mono的Linux上运行,我会得到以下异常:
- ChangeConfigurationAsync(): gRPC call failed with exception=[System.IO.FileNotFoundException: Message="Error loading native library. Not found in any of the possible locations: /tmp/apache-temp-aspnet-0/17ae072c/assembly/shadow/bc23f1e5/69f27fa4_d5d18e41_00000001/libgrpc_csharp_ext.x64.so,
/tmp/apache-temp-aspnet-0/17ae072c/assembly/shadow/bc23f1e5/69f27fa4_d5d18e41_00000001/runtimes/linux/native/libgrpc_csharp_ext.x64.so,
/tmp/apache-temp-aspnet-0/17ae072c/assembly/shadow/bc23f1e5/69f27fa4_d5d18e41_00000001/../../runtimes/linux/native/libgrpc_csharp_ext.x64.so"
, StackTrace="
at Grpc.Core.Internal.UnmanagedLibrary.FirstValidLibraryPath (System.String[] libraryPathAlternatives) [0x00042] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.Internal.UnmanagedLibrary..ctor (System.String[] libraryPathAlternatives) [0x00006] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.Internal.NativeExtension.Load () [0x00044] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.Internal.NativeExtension..ctor () [0x00006] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.Internal.NativeExtension.Get () [0x00022] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.Internal.NativeMethods.Get () [0x00000] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.GrpcEnvironment.GrpcNativeInit () [0x00000] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.GrpcEnvironment..ctor () [0x0001e] in <f30adad8041c4e6ba2a109e705aeb795>:0 \n
at Grpc.Core.GrpcEnvironment.AddRef () [0x00028] in <f30adad8041c4e6ba2a109e705aeb795>:0
at Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) [0x00051] in <f30adad8041c4e6ba2a109e705aeb795>:0
at Grpc.Core.Channel..ctor (System.String host, System.Int32 port, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) [0x00012] in <f30adad8041c4e6ba2a109e705aeb795>:0
at MediaGateway.Shared.ConfigurationChangeInterface.Impl.ConfigurationChangeClient+<ChangeConfigurationAsync>d__6.MoveNext () [0x000da] in <208a1a3cb2734ae9bbbbc700fc47e4cd>:0 "] ({})
libgrpc_csharp_ext.x64.so与其他托管DLL放在同一个“bin”目录中,但遗憾的是.so文件未复制到卷影副本目录。
据我所知,gRPC库无法配置为在其他目录中查找非托管库。我们的其他单声道守护进程也没有问题,通常使用gRPC以“mono xy.exe”开头。
我们正在使用:
答案 0 :(得分:0)
您可以尝试设置shadowCopyBinAssemblies =&#34; false&#34;在你的Web.config中:
<system.web>
<hostingEnvironment shadowCopyBinAssemblies="false"/>
</system.web>
旧的MSDN文档(没有在docs.microsoft.com上找到它): https://msdn.microsoft.com/en-us/library/ms228159(v=vs.100).aspx