ThinkGeo.com    |     Documentation    |     Premium Support

BingMapsMetadata file not downloading

Hello,

We have an older product that is currently using Desktop Edition 8.0.
Yesterday it seems the BingMapsMetadata.xml file is no longer getting downloaded when using the BingMapsLayer. Prior to yesterday it used to refresh when changing BingMapsMapTypes and was stored and refreshed in the cache directory every time we accessed BingMaps. We are currently converting this application to a webapp using version 11 of the Web Edition and it can still access Bing.

Can you give some solutions to this and do you have any idea of why this would all of a sudden change? This happens on all our servers and locally. We still need our older product to run with BingMaps.

Thank you,
Jesse Mabon

Hi Jesse,

I think that’s because Bing map change it’s SSL strategy, I hadn’t found the news about it, but Bing’s user should had received it’s email.

As below is a workaround. You can try to use this code when your application startup:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

Please try it and let us know whether it works.

Regards,

Ethan

Hello Ethan,

Thanks for the reply. I tried adding that code to our startup and it did not change anything. I have attached a sample application to see if you get the same results on your end and you can hopefully get us to a solution.
Currently there is an xml file in the bin\Release\Bingmaps folder. So it works at first when you run it. If you delete that xml file it will no longer work because it does not download a new one like it used to.
Let me know if you have any issues with the app.

Thanks,
Jesse
BingServer2012.zip (3.0 MB)

Ethan, i created a support ticket for this because we need a solution as soon as possible and added some information we got from Microsoft during a screen share.

Thanks,
Jesse

Hi Jesse,

Thanks for your update, we will reply you in your ticket.

Regards,

Ethan

How do I find the ticket that was created to this issue? We have noticed this same problem, but in our case it only seems to be an issue in Windows 7. Our Windows 10 machines do not seem to have a problem.

Thank you,
Brian Hughes
MapShots

Hello Brian,

The ticket never really resolved anything. It just started working again after going back and forth with ThinkGeo and Microsoft. We just ran into this again this week. It stopped working on our servers in Oregon but other places in the US it worked. I couldn’t get it to create the xml file locally but if i turned my VPN on to change my IP location it would work again. I implemented a fix on our end that bypasses the ThinkGeo control being in charge of creating the xml file. Because i found that if you pull straight from the Bing API and create the file first, BingMaps then works in the control.

From what i can tell, the old ThinkGeo control might be using invalid parameters for the Bing API and maybe based on what bing server it’s pulling from, it errors trying to retrieve. Just a theory though based on reading this link: https://docs.microsoft.com/en-us/bingmaps/rest-services/imagery/get-imagery-metadata. In here it has the words of the imagery type as the parameter but in the link ThinkGeo sent me, they were passing in the MapType integer value. And when i tried to use the numbers pulling the xml straight from Bing, some would error and some would work.

So… I created my own links to pull and save the xml file at the start of my program so they are there when the ThinkGeo control needs them. Here is the code i used to pull and create my own xml straight from the Bing API:

            Dim loginServiceTemplate As String = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/{0}?&incl=ImageryProviders&o=xml&key={1}"
            Dim strUri As String = ""
            Dim wc As New Net.WebClient
            Dim xmlText As String = ""
            If File.Exists(mobjUserFolders.BingMaps & "Road\BingMapsMetadata.xml") = False Then
                strUri = String.Format(System.Globalization.CultureInfo.InvariantCulture, loginServiceTemplate, "RoadOnDemand", BINGKEY)
                xmlText = wc.DownloadString(strUri)
                File.WriteAllText(mobjUserFolders.BingMaps & "Road\BingMapsMetadata.xml", xmlText)
            End If
            If File.Exists(mobjUserFolders.BingMaps & "Aerial\BingMapsMetadata.xml") = False Then
                strUri = String.Format(System.Globalization.CultureInfo.InvariantCulture, loginServiceTemplate, "Aerial", BINGKEY)
                xmlText = wc.DownloadString(strUri)
                File.WriteAllText(mobjUserFolders.BingMaps & "Aerial\BingMapsMetadata.xml", xmlText)
            End If
            If File.Exists(mobjUserFolders.BingMaps & "AerialWithLabels\BingMapsMetadata.xml") = False Then
                strUri = String.Format(System.Globalization.CultureInfo.InvariantCulture, loginServiceTemplate, "AerialWithLabelsOnDemand", BINGKEY)
                xmlText = wc.DownloadString(strUri)
                File.WriteAllText(mobjUserFolders.BingMaps & "AerialWithLabels\BingMapsMetadata.xml", xmlText)
            End If

I was going to share this with them today so they can look into it but hopefully this will help you as well in the meantime.

Jesse

Hi Jesse,

Thanks for your research and share your solution about this problem.

You mentioned in some of our old version the request url use invalid parameter, I think that’s possible. And in one of your server you met this problem again, could you please let us know what’s the dll version of it now? If that’s the latest version we will check the problem.

Regards,

Ethan

Jesse,

Thank you for your update. I tested a fix based on your code in our development environment and it seems to resolve the issue for us on those machines that were having problems.

Thanks,
Brian Hughes
MapShots

Hi Brian,

I am glad to hear Jesse’s share is helpful, thanks for your update about it also.

I will let our developer know this problem.

Regards,

Ethan