为什么.net核心不支持TransportWithMessageCredential? [英] Why TransportWithMessageCredential is not supported in .net core?
问题描述
我正在尝试在.net核心中使用SOAP服务
I am trying to consume a SOAP Service in .net core
我要将安全模式下的基本httpbinding设置为TransportWithMessageCredential
I want to set the basic httpbinding with security mode as TransportWithMessageCredential
和clientcredentialType作为证书
and clientcredentialType as Certificate
但是我遇到了错误
在此上下文中,绑定安全属性"securityMode"不支持值"TransportWithMessageCredential".
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];
我在这里犯一些严重的错误吗?有相同的解决方案吗?
Am I doing some serious mistake here? Any Solution for the same?
[我能够在.net框架中实现此目标,但不能在.net核心中实现>
[I am able to achieve this in .net framework but not in .net core]
推荐答案
此问题已在较新版本的System.ServiceModel.*程序包中解决(4.7.0为我工作).
This problem is solved in newer versions of System.ServiceModel.* packages (4.7.0 worked for me).
请参见 https://github.com/dotnet/wcf/issues/4045#issuecomment-577854822
这篇关于为什么.net核心不支持TransportWithMessageCredential?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!