3

Any ideas on how to include a client certificate in a POST request to an external API using .NET Core, running on a Mac? I would do this with WebRequestHandler from the Microsoft.Net.Http nupkg, but it looks like it's not available--I'm getting DNXCore,Version=v5.0 error CS0246: The type or namespace name 'WebRequestHandler' could not be found.

using System.Net.Http;

public class ServiceWrapper {
    public void Post() {
        var handler = new WebRequestHandler();

    }

}

Dependencies, from project.json:

"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Dapper": "1.50.0-beta8",
"Autofac": "4.0.0-rc1-177",
"Autofac.Extensions.DependencyInjection": "4.0.0-rc1-177",
"AutoMapper": "4.2.1",
"System.Xml.XmlSerializer": "4.0.11-beta-23516",
"Microsoft.AspNet.WebApi.Client": "5.2.3",
"Microsoft.Net.Http": "2.2.29",
"Microsoft.Net.Http.Client": "1.0.0-beta8-15501"
}

My ~/.config/nuget/nuget.config:

<configuration>
  <packageSources>
    <add key="vnext" value="https://www.myget.org/F/aspnetvnext/api/v2" />
    <add key="Official NuGet Gallery" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <activePackageSource>
    <add key="Official NuGet Gallery" value="https://www.nuget.org/api/v2/" />
  </activePackageSource>
</configuration>
Romi Petrelis
  • 536
  • 6
  • 6

0 Answers0