This below is all my code which is a copy paste from Web API book I am reading.
public class PageSizeController : ApiController
{
private static string TargetUrl = "http://apress.com";
public long GetPageSize()
{
WebClient wc = new WebClient();
Stopwatch sw = Stopwatch.StartNew();
byte[] apressData = wc.DownloadData(TargetUrl);
Debug.WriteLine("Elapsed Time: ", sw.ElapsedMilliseconds);
return apressData.LongLength;
}
}
}
When I make the API call : http://localhost:38000/api/pagesize
It throw this exception on DownloadData
method:
System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'
This is not very welcoming when you open a book to follow the examples and it just doesn't work for their HelloWorld application.