none
The underlying connection was closed: Could not establish trust relationship for TLS/SSL secure channel RRS feed

  • Question

  • I am new to Bing Maps and i was following the github example on the official Microsoft post for Bing Maps.

    I downloaded the sample project for WPF and it runs fine with my API key. As soon as i use the same code in my application with the same API key i get the following error:

    The underlying connection was closed: Could not establish trust relationship for TLS/SSL secure channel

    Here is the code i use to call the request. I noticed that the request being sent on my app and the downloaded Bing one is slightly different with different properties, the request URL seems the same though so not sure whats wrong.

    private void GetGeocode()

    {

                var r = new GeocodeRequest()
                {
                    Query = "Westminster Bridge Road, London, UK SE17PB",
                    IncludeIso2 = true,
                    IncludeNeighborhood = true,
                    MaxResults = 25,
                    BingMapsKey = BingMapsKey
                };

                ProcessRequest(r);

    }

    private async void ProcessRequest(BaseRestRequest request)
            {
                try
                {
                    var start = DateTime.Now;

                    // I GET THE ERROR AFTER THIS LINE AND THROWS THE EXCEPTION AS DESCRIBED ABOVE
                    var response = await request.Execute((remainingTime) =>
                    {
                        if (remainingTime > -1)
                        {
                            _time = TimeSpan.FromSeconds(remainingTime);

                            _timer.Start();
                        }
                    });

                    bingURL.Text = request.GetRequestUrl();

                    var result = response.ResourceSets[0].Resources[0] as BingMapsRESTToolkit.Location;

                    var points = result.Point.ToString();

                    bingURL.Text = points;

                    var end = DateTime.Now;

                    var processingTime = end - start;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                _timer.Stop();
            }


    • Edited by DanJBurton Monday, February 17, 2020 11:51 AM
    Monday, February 17, 2020 11:50 AM