admin管理员组文章数量:1129657
I have a problem, I am developing an application in .NET 8 based on an existing one in Visual Basic that used a web service of type SOAP. To be able to use this web service I pass it a certificate and use a BasicHttpsBinding
with Security.Mode = BasicHttpsSecurityMode.Transport
.
The problem I have is that when I call the web service it returns an error saying that the security header is missing and the message is not signed. The previous application had a line where I selected the Protection level to Sign but now in .NET 8 I can't access that property.
I leave you the code I have in case I am missing something, I have been doing this for many months and I can't find the solution.
SOAPService _cliente = new SOAPServicePortTypeClient(SOAPServicePortTypeClient.EndpointConfiguration.SOAPServicePort);
var binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
_cliente.Endpoint.Binding = binding;
_cliente.ClientCredentials.ClientCertificate.Certificate = await _certificadoCnmvService.GetCertificado();
_cliente.ClientCredentials.ServiceCertificate.DefaultCertificate = ObtenerCertificadoX509_BD("Certificado");
_cliente.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
X509CertificateValidationMode.None;
_cliente.ClientCredentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
_cliente.Endpoint.EndpointBehaviors.Add(new CustomEndpointBehavior());
var request = createrequest(contrato);
var response = _cliente.WebService(request);
In the old app, I was using
_cliente.Endpoint.Contract.ProtectionLevel = System.Net.Security.ProtectionLevel.Sign
but now in .NET 8, this is impossible.
Any idea about how I can do this? I need send the request signed.
I did try all about the code.
本文标签: soapNET 8 set SystemNetSecurityProtectionLevelStack Overflow
版权声明:本文标题:soap - .NET 8 set System.Net.Security.ProtectionLevel - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736713872a1949089.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论