我正在尝试在 .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/