First of all there is a ton of question with the same title but I believe my problem is little bit different from other questions. I would like to state that everything where perfectly fine about two days ago. I haven’t changed anything in code.
We are not required to install any SSL certificate to our servers or local computers. The url of the WCF service opens normally on browser (https://sampleurl.com/service.svc)
I created a console application for testing purposes, it works but it doesn’t work on our .net mvc 5 project.
How I call service:
CustomerServiceClient client = new CustomerServiceClient();
client.ClientCredentials.UserName.UserName = "[email protected]";
client.ClientCredentials.UserName.Password = "asfasf";
var result = client.GetInformation("1MS0274796");
The response is;
System.ServiceModel.Security.SecurityNegotiationException: 'Could not establish secure channel for SSL/TLS with authority 'servis.vatanbilgisayar.com'.'
Inner Exception:
WebException: The request was aborted: Could not create SSL/TLS secure channel.
What I’ve tried
I added the line below before service call and it didn’t worked.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
And
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
(se, cert, chain, sslerror) =>
{
return true;
};
This addition to code throws error below;
The certificate key algorithm is not supported
web.config;
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="CustomerServiceSoap">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://xyzx.com/CustomerService.svc"
binding="wsHttpBinding" bindingConfiguration="CustomerServiceSoap"
contract="xfasf.asfasf" name="CustomerServiceSoap" />
</client>
</system.serviceModel>