【发布时间】:2020-02-10 00:02:21
【问题描述】:
我正在尝试使用 wcf 通过相互证书进行 SOAP 调用,但也不断出错
'请求被中止:无法创建 SSL/TLS 安全通道。' 或
'远程服务器返回错误:(500) Internal Server Error Missing wsse:Security header in request'
在 SOAP UI 中完成的类似请求有效,但 C# 不想通过。我还查看了发送的具体内容,发现肥皂信封确实缺少标题中的 wsse:Security。我怎样才能让它发挥作用?
WSHttpBinding myBinding = new WSHttpBinding();
myBinding.Security.Mode = SecurityMode.Transport;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
EndpointAddress ea = new EndpointAddress("https://[securedEndpoint]/Calculator");
CalculatorClient cc = new CalculatorClient(myBinding, ea);
cc.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.Root,
X509FindType.FindBySerialNumber,
"37802b632e74e355");
cc.ClientCredentials.ServiceCertificate.SetDefaultCertificate(
StoreLocation.CurrentUser,
StoreName.Root,
X509FindType.FindBySerialNumber,
"29f3e22fc1ae45be");
// Begin using the client.
try
{
cc.Open();
Console.WriteLine(cc.Add(200, 1111));
Console.ReadLine();
// Close the client.
cc.Close();
}
【问题讨论】:
标签: c# wcf ssl soapui mutual-authentication