在CentOS下运行我的服务器时,我遇到了一个奇怪的错误。它说它是Unable to load DLL 'System.Net.Http.Native'
(参见下面的例外),它只发生在我使用systemd启动服务器或在Linux屏幕中手动启动服务器时,而不是在常规shell(Bash,PuTTY)中。
为什么会这样?根据我在Google上发现的内容,这似乎是openssl-libs的一个问题,但它是如何在shell中工作的呢?
对Linux很新,我不知道环境之间的区别。
我在所有情况下都使用相同的用户。 systemd .service是最小的默认类型,只有After = network.target 服务器不使用TLS / SSL加密。
CentOS Linux版本7.4.1708(核心版) Dotnet --version 2.0.3
以下是dependencies的列表(根据百胜)。我已经更新了所有软件包,因此没有更高版本可用(在Yum中)。
libunwind.x86_64 2:1.2-2.el7
lttng-ust.x86_64 2.4.1-4.el7)
libcurl.x86_64 7.29.0-42.el7_4.1
openssl-libs.x86_64 1:1.0.2k-8.el7
libuuid.x86_64 2.23.2-43.el7_4.2
krb5-libs.x86_64 1.15.1-8.el7
libicu.x86_64 50.1.2-15.el7
zlib.x86_64 1.2.7-17.el7
例外情况:
System.TypeInitializationException: The type initializer for 'System.Net.Http.CurlHandler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Http' threw an exception. ---> System.TypeInitializationException: The type initializer for 'HttpInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Net.Http.Native': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
at Interop.Http.GetSslVersionDescription()
at Interop.HttpInitializer..cctor()
--- End of inner exception stack trace ---
at Interop.Http..cctor()
--- End of inner exception stack trace ---
at Interop.Http.GetSupportedFeatures()
at System.Net.Http.CurlHandler..cctor()
--- End of inner exception stack trace ---
at System.Net.Http.CurlHandler..ctor()
at System.Net.Http.HttpClientHandler..ctor()
at Veridict.LiveMap.ServerPlatform.Modules.GtfsRt.GtfsRtModule.Run()
at System.Threading.Thread.ThreadMain_ThreadStart()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
(我最初在dotnet GitHub上发布了issues)