{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/cli/issues/4635","repository_url":"https://api.github.com/repos/dotnet/cli","labels_url":"https://api.github.com/repos/dotnet/cli/issues/4635/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/cli/issues/4635/comments","events_url":"https://api.github.com/repos/dotnet/cli/issues/4635/events","html_url":"https://github.com/dotnet/cli/issues/4635","id":187624185,"number":4635,"title":"dotnet on an AWS Linux instance throws a: System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl'","user":{"login":"samuelyounge","id":3517111,"avatar_url":"https://avatars.githubusercontent.com/u/3517111?v=3","gravatar_id":"","url":"https://api.github.com/users/samuelyounge","html_url":"https://github.com/samuelyounge","followers_url":"https://api.github.com/users/samuelyounge/followers","following_url":"https://api.github.com/users/samuelyounge/following{/other_user}","gists_url":"https://api.github.com/users/samuelyounge/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelyounge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelyounge/subscriptions","organizations_url":"https://api.github.com/users/samuelyounge/orgs","repos_url":"https://api.github.com/users/samuelyounge/repos","events_url":"https://api.github.com/users/samuelyounge/events{/privacy}","received_events_url":"https://api.github.com/users/samuelyounge/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-07T04:41:41Z","updated_at":"2016-11-07T23:42:35Z","closed_at":"2016-11-07T23:42:35Z","body":"dotnet on an AWS Linux instance throws a: System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl' exception.\r\n\r\nProject ran fine before adding HttpContext.Session support which apparently added additional dependencies.  I tried loading different versions of \"System.Security.Cryptography.Algorithms\":  which did change the error message but was unable run exception free despite the changes. I ended up sticking with \"4.3.0-preview1-24530-04\" and trying to upgrade openssl on linux box, without success (possible pathing problem, not sure what directories dotnet looks in for libraries and bins).\r\n\r\nBTW, project runs fine on Windows 10 development box using Visual Studio Community 2015's debug feature.  It is only when project is migrated to production server that it fails.\r\n\r\nAll advice is welcome, thanks, Sam.\r\n\r\n## Steps to reproduce\r\nOn a AWS Linux instance.\r\nproject.json:\r\n{\r\n  \"dependencies\": {\r\n    \"Microsoft.NETCore.App\": {\r\n      \"version\": \"1.0.1\",\r\n      \"type\": \"platform\"\r\n    },\r\n    \"Microsoft.AspNetCore.Diagnostics\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Mvc\": \"1.0.1\",\r\n    \"Microsoft.AspNetCore.Razor.Tools\": {\r\n      \"version\": \"1.0.0-preview2-final\",\r\n      \"type\": \"build\"\r\n    },\r\n    \"Microsoft.AspNetCore.Routing\": \"1.0.1\",\r\n    \"Microsoft.AspNetCore.Server.IISIntegration\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Server.Kestrel\": \"1.0.1\",\r\n    \"Microsoft.AspNetCore.StaticFiles\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.EnvironmentVariables\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.Json\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.Binder\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging.Console\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging.Debug\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Options.ConfigurationExtensions\": \"1.0.0\",\r\n    \"Microsoft.VisualStudio.Web.BrowserLink.Loader\": \"14.0.0\",\r\n    \"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore\": \"1.0.0\",\r\n    \"jQuery\": \"3.1.1\",\r\n    \"Microsoft.AspNetCore.Session\": \"1.1.0-preview1-final\",\r\n    \"Microsoft.Framework.Caching.Memory\": \"1.0.0-beta8\",\r\n    \"Microsoft.Framework.Caching.Abstractions\": \"1.0.0-beta8\",\r\n    \"Microsoft.Extensions.Caching.Memory\": \"1.1.0-preview1-final\",\r\n    \"System.Security.Cryptography.Algorithms\": \"4.3.0-preview1-24530-04\"\r\n  },\r\n\r\n  \"tools\": {\r\n    \"BundlerMinifier.Core\": \"2.0.238\",\r\n    \"Microsoft.AspNetCore.Razor.Tools\": \"1.0.0-preview2-final\",\r\n    \"Microsoft.AspNetCore.Server.IISIntegration.Tools\": \"1.0.0-preview2-final\"\r\n  },\r\n\r\n  \"frameworks\": {\r\n    \"netcoreapp1.0\": {\r\n      \"imports\": [\r\n        \"dotnet5.6\",\r\n        \"portable-net45+win8\"\r\n      ]\r\n    }\r\n  },\r\n\r\n  \"buildOptions\": {\r\n    \"emitEntryPoint\": true,\r\n    \"preserveCompilationContext\": true\r\n  },\r\n\r\n  \"runtimeOptions\": {\r\n    \"configProperties\": {\r\n      \"System.GC.Server\": true\r\n    }\r\n  },\r\n\r\n  \"publishOptions\": {\r\n    \"include\": [\r\n      \"wwwroot\",\r\n      \"**/*.cshtml\",\r\n      \"appsettings.json\",\r\n      \"web.config\"\r\n    ]\r\n  },\r\n\r\n  \"scripts\": {\r\n    \"prepublish\": [ \"bower install\", \"dotnet bundle\" ],\r\n    \"postpublish\": [ \"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%\" ]\r\n  }\r\n}\r\n\r\nFrom project directory:\r\ndotnet restore\r\ndotnet run\r\n\r\n## Expected  behavior\r\nDownload libraries\r\nCompile project\r\nRun project\r\n\r\n## Actual behavior\r\nDownloads libraries\r\nCompiles project\r\nThrows exception:\r\nlog  : Restoring packages for /var/www/faithmail/project.json...\r\nlog  : Restoring packages for tool 'BundlerMinifier.Core' in /var/www/faithmail/project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in /var/www/faithmail/project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in /var/www/faithmail/project.json...\r\nlog  : Lock file has not changed. Skipping lock file write. Path: /var/www/faithmail/project.lock.json\r\nlog  : /var/www/faithmail/project.json\r\nlog  : Restore completed in 3436ms.\r\nProject faithmail (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.\r\ninfo: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]\r\n      User profile is available. Using '/var/www/faithmail/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.\r\nHosting environment: Production\r\nContent root path: /var/www/faithmail\r\nNow listening on: http://localhost:5000\r\nApplication started. Press Ctrl+C to shut down.\r\ninfo: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]\r\n      Request starting HTTP/1.1 GET http://localhost:5000/  \r\nfail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]\r\n      An unhandled exception has occurred: The type initializer for 'Crypto' threw an exception.\r\nSystem.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found.\r\n (Exception from HRESULT: 0x8007007E)\r\n   at Interop.Crypto.GetMaxMdSize()\r\n   at Interop.Crypto..cctor()\r\n   --- End of inner exception stack trace ---\r\n   at Interop.Crypto.GetRandomBytes(Byte[] buf, Int32 num)\r\n   at System.Security.Cryptography.RNGCryptoServiceProvider.GetBytes(Byte[] data)\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()\r\n\r\nStarts webserver but fails to run project\r\n\r\n## Environment data\r\n`dotnet --info` output:\r\n[root@ip-172-30-1-143 ec2-user]# dotnet --info\r\n.NET Command Line Tools (1.0.0-preview2-003131)\r\n\r\nProduct Information:\r\n Version:            1.0.0-preview2-003131\r\n Commit SHA-1 hash:  635cf40e58\r\n\r\nRuntime Environment:\r\n OS Name:     amzn\r\n OS Version:  2016.09\r\n OS Platform: Linux\r\n RID:         amzn.2016.09-x64\r\n\r\n\r\nyum info openssl\r\nLoaded plugins: priorities, update-motd, upgrade-helper\r\nInstalled Packages\r\nName        : openssl\r\nArch        : x86_64\r\nEpoch       : 1\r\nVersion     : 1.0.1k\r\nRelease     : 15.96.amzn1\r\nSize        : 3.6 M\r\nRepo        : installed\r\nFrom repo   : amzn-updates\r\nSummary     : Utilities from the general purpose cryptography library with TLS implementation\r\nURL         : http://www.openssl.org/\r\nLicense     : OpenSSL\r\nDescription : The OpenSSL toolkit provides support for secure communications between\r\n            : machines. OpenSSL includes a certificate management tool and shared\r\n            : libraries which provide various cryptographic algorithms and\r\n            : protocols.\r\n\r\nAvailable Packages\r\nName        : openssl\r\nArch        : i686\r\nEpoch       : 1\r\nVersion     : 1.0.1k\r\nRelease     : 15.96.amzn1\r\nSize        : 1.5 M\r\nRepo        : amzn-updates/latest\r\nSummary     : Utilities from the general purpose cryptography library with TLS implementation\r\nURL         : http://www.openssl.org/\r\nLicense     : OpenSSL\r\nDescription : The OpenSSL toolkit provides support for secure communications between\r\n            : machines. OpenSSL includes a certificate management tool and shared\r\n            : libraries which provide various cryptographic algorithms and\r\n            : protocols.\r\n\r\nAlso, tried installing OpenSSL 1.1.0b\r\nIt had no effect though I am not sure the default pathing allows dotnet to see the 1.1.0b libraries.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"samuelyounge"}}