title: The type initializer for 'System.Net.Http.CurlHandler' threw an exception
body: <p>I'm getting a weird error while running my server under CentOS. It said it is <code>Unable to load DLL 'System.Net.Http.Native'</code> (see exception below), and it only occurs when I start the server during startup using systemd or manually in Linux Screen, not in regular shell (Bash, PuTTY). </p>
  
  <p>Why is this happening? From what I have found on Google, it seems to be an issue with openssl-libs, but how come it is working in the shell? </p>
  
  <p>Being quite new to Linux I don't know the difference between the environments. </p>
  
  <h2>More details below</h2>
  
  <p>I use the same user in all cases.
  The systemd .service is minimal, default type, only an After=network.target
  The server does not use TLS/SSL encryption. </p>
  
  <p>CentOS Linux release 7.4.1708 (Core)
  Dotnet --version 2.0.3</p>
  
  <p>Here is a list of the <a href="https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x" rel="nofollow noreferrer">dependencies</a> (according to Yum). I've updated all packages so there are not later version available (in Yum).  </p>
  
  <pre><code>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 
  </code></pre>
  
  <p>The exception details:</p>
  
  <pre><code>System.TypeInitializationException: The type initializer for 'System.Net.Http.CurlHandler' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'Http' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'HttpInitializer' threw an exception. ---&gt; 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)
  </code></pre>
  
  <p>(I originally posted it on dotnet GitHub <a href="https://github.com/dotnet/corefx/issues/25774" rel="nofollow noreferrer">issues</a>)</p>