I am developing an Dotnet core 2.x(actually using 2.1.4, latest release when I'm writing this) web api project, in order to use couchbase as my database server, I need to use the couchbase SDK. The sdk states that it supports DotNet core 2.x.
After a very basic setup and I just want to test the connectivity, I keep getting this error.
HttpRequestException: The handler does not support custom handling of certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").
I thought this is a issue with the couchbase SDK, but after some research, I found it is about the macOS built-in openssl and curl does not support certain behavior. Here are some reference:
.NET Core, OSX, libcurl, and OpenSSL
Couchbase dotnet SDK OSX libcurl error
after some more research, it turns out that dotnet core 2.0 should no longer suffer from the MacOS related issue...But why am I still getting this?
Is there any workaround like telling HttpClient to use brew version of curl?
Here's what I needed to do to get this to work:
AspNetCore.All ReferenceNuGet.ConfigDownload and install macOs installer
AspNetCore.All ReferenceUpdate package reference to:
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0-preview1-final" />
NuGet.ConfigUpdate ~/.nuget/NuGet/NuGet.Config and add another package source:
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
I needed to do this because I was getting a NuGet error:
error NU1102: Unable to find package Microsoft.AspNetCore.All with version (>= 2.1.0).
In my Startup.cs I set an environment variable:
Environment.SetEnvironmentVariable("DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER", "true");
With 2.1 dotnet will incorporate its own Socket Handler which bypasses OS specific ones and so we can avoid the macOS issues. In preview-1 we still have to manually opt-in: https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs
But soon in preview-2 it'll be on by default: https://github.com/dotnet/corefx/pull/27821
I've been investigating the same issue this morning and I currently don't think there's a clear solution. Dotnet Core 2.x does not resolve the issue for the Couchbase SDK, though I think using HttpClient outside of Couchbase is fine (haven't tested this).
As of Couchbase SDK Version 2.5.8 (17 March 2018) this is still a known issue: https://developer.couchbase.com/server/other-products/release-notes-archives/dotnet-sdk
Actual issue link: https://issues.couchbase.com/browse/NCBC-1296
In the forums, see:
I'll post back if I find a working solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With