关于如何在 Mac 上运行的使用 .NET Core 的外部 API 的 POST 请求中包含客户端证书的任何想法?我会WebRequestHandler
从Microsoft.Net.Http
nupkg 执行此操作,但看起来它不可用 - 我正在获取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();
}
}
依赖项,来自 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"
}
我的 ~/.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>