Reputation: 94
This is the situation: New project (console or forms). I go to References, add new service reference. I write the url and I get an error about that the request is cancelled due to that it can't be stablished a secure channel for SSL/TLS. Without https, it works. A friend tested in other windows 10 and no problem. With Iexplorer or chrome, no problem, I see the xml of the wdsl, but with visual studio impossible, it doesn't work. I've tested all the posts that I've seen but nothing. The only way is to generate the proxy class with wdsl.exe
Any idea about this? Regards.
Upvotes: 0
Views: 1583
Reputation: 7522
Do you mean that you fail to invoke the wcf service by adding the service reference when the service is hosted over https?
If the server uses the self-signed certificate as the server identity credential, there is a default step validates the server certificate on the client side. you could refer to the following code.
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient();
try
{
var result = client.SayHello();
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Feel free to let me know if the problem still exists.
Upvotes: 1
Reputation: 5624
This is because the SSL certificate is not installed in your certificate repository.
Open the web service URL in browser.
It would prompt you to install the SSL CA to your local machine's certificate repository.
The dialog would be showing two options "Local User", "Local Machine".
You MUST select "Local Machine".
Then you should be able to add service reference even using SSL url.
This should solve your issues.
Upvotes: 0