c# - 为什么 .net 核心不支持 TransportWithMessageCredential?

标签 c# wcf soap .net-core client-certificates

我正在尝试在 .net core 中使用 SOAP 服务

我想将安全模式的基本 httpbinding 设置为 TransportWithMessageCredential

和 clientcredentialType 作为证书

但我收到一个错误

The value 'TransportWithMessageCredential' is not supported in this context for the binding security property 'securityMode'.



代码看起来像这样
var client = new SoapCustomClient();

var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
client.ClientCredentials.ClientCertificate.Certificate = certCollection[0];

我在这里犯了一些严重的错误吗?
任何解决方案?

[我能够在 .net 框架中实现这一点,但不能在 .net 核心中实现]

最佳答案

这个问题在较新版本的 System.ServiceModel.* 包中得到解决(4.7.0 对我有用)。
https://github.com/dotnet/wcf/issues/4045#issuecomment-577854822

关于c# - 为什么 .net 核心不支持 TransportWithMessageCredential?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53852580/

相关文章:

c# - 在 Xamarin Forms 中获取缓存图像源的原始高度和宽度

c# - body 参数 'width' 。 GET 操作不能有主体?

xml - 在 Wiremock 中评估返回 bool 值的表达式 - 请求匹配条件

c# - 从WCF获取数据

java - 轻量级 Java Web 服务

ios - 如何使用netsuite API在移动设备上获取数据?

c# - StructureMap 到 Ninject 的转换

C# FIPS 140-2 加密

c# - iOS 不支持全局 PushAsync,请使用 NavigationPage

c# - 我可以从共享接口(interface)继承我的 WCF DataContract 吗?