none
Route service throws exception about distance being to long! RRS feed

  • Question

  • Hi,

    I'm using the Bing Route Service to calculate the route between two locations from my WP7 device, but the service seems very shaky. The last week it continously reported an exception about the distance being to long to calculate, even if the distance only is about 500 km. Then it suddenly worked again for a day or so, but now when I tried it again this morning it failed again with the same exception message. Right now, at the time of writing this post, it works again...

    Is Microsoft having problems with the Bing service or what is the problem here, it seems very shaky right now?!

    Best regards,

    Joel

    • Moved by Ricky_Brundritt Friday, March 9, 2012 5:18 PM (From:Bing Maps: Map Control and Web services Development)
    Tuesday, March 22, 2011 9:55 AM

Answers

  • One solution I found is to suppress faults:

    RouteService.RouteRequest routeRequest = new RouteService.RouteRequest();
    ExecutionOptions executionOptions = new ExecutionOptions();
    executionOptions.SuppressFaults = true;
    routeRequest.ExecutionOptions = executionOptions;
    

    • Proposed as answer by naic Tuesday, June 21, 2011 9:32 PM
    • Marked as answer by Ricky_Brundritt Thursday, August 1, 2013 12:44 PM
    Tuesday, April 26, 2011 8:09 PM

All replies

  • I haven't noticed any issues. Which service are you using. The SOAP or REST services?
    Windows Live Developer MVP - http://rbrundritt.wordpress.com | http://inknowledge.co.uk
    • Proposed as answer by VBalu987 Tuesday, December 4, 2012 1:40 PM
    Tuesday, March 22, 2011 10:08 AM
  • SOAP where the proxy has been generated from the following url, http://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc, according to the documentation at http://msdn.microsoft.com/en-us/library/cc966738.aspx.

    Tuesday, March 22, 2011 11:31 AM
  • Can you post the whole error message so we can help you.

    I've got this behaviour one time, it was about a length-exceeding message that you can configure in the binding.


    MVP - Bing Maps - My blog (FR): http://blogs.developpeur.org/nicoboo/ Twitter: http://twitter.com/nicolasboonaert/
    Tuesday, March 22, 2011 3:19 PM
    Moderator
  • I will, as soon as it stops working, because right now it works as expected again!
    Wednesday, March 23, 2011 7:42 AM
  • Now the service fails again to calculate longer routes, with the following exception message.

    FaultException: "The route distance is too long to calculate a route."

    I don't see any other useful information in the exception.

    Any clues?

    Wednesday, March 23, 2011 7:58 PM
  • Can you give an example of the locations between which you're trying to route?
    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Wednesday, March 23, 2011 10:45 PM
    Moderator
  • Try getting a route from Seattle to New York and see if it consistently throws an error. If so, like Alastair said it's likely just a matter of increasing the max received message size in the config file.
    Windows Live Developer MVP - http://rbrundritt.wordpress.com | http://inknowledge.co.uk
    Thursday, March 24, 2011 10:00 AM
  • Sure, try from the city "Lund, Sweden" to the city "Stockholm, Sweden" or from the Country "Austria" to "Belgium". Right now this doesn't work at all for me, but probably if I try again later today it will work again without any modifications at all from my part. Can it be that the services accessed from where I live, in Sweden, are using other more shaky servers than when you try?

    Thursday, March 24, 2011 10:11 AM
  • I think the problem is solved now, it was simply a configuration problem, where I sometimes happened to use "Walking" instead of "Driving" as travel mode. That explains why it worked sometimes, even if it's quite possible to walk from Seattle to New York ;).

    Thanks!

    Thursday, March 24, 2011 9:07 PM
  • Hi,

    I have the same problem when I use the Walking mode with longer distances. Is there any possibility to catch this exception and if yes where?

    Thanks in advance.

    • Marked as answer by Joel_F Sunday, April 3, 2011 9:30 PM
    • Unmarked as answer by Ricky_Brundritt Thursday, August 1, 2013 12:44 PM
    Sunday, April 3, 2011 2:26 PM
  • I don't have the code in front of me right now, but you can catch the exception when accessing the Result property on the event arguments passed in to the callback method for the route result.
    Sunday, April 3, 2011 9:33 PM
  • Hi,

    no, it doesn't work. Can anybody help me?

     

    private void routeService_CalculateRouteCompleted(object sender, RouteService.CalculateRouteCompletedEventArgs e)
    {
     try{  
      if ((e.Result.ResponseSummary.StatusCode == RouteService.ResponseStatusCode.Success) && (e.Result.Result.Legs.Count > 0))
      {
       Pair indizes = (Pair)e.UserState;   
       
      else if (e.Result.ResponseSummary.StatusCode == RouteService.ResponseStatusCode.ServerError)
      {
       MessageBox.Show("There is a problem with the Bing Maps Server!");
       routeService.CloseAsync();
       routeService.Abort();
      }
      else if (e.Result.ResponseSummary.StatusCode == RouteService.ResponseStatusCode.BadRequest)
      {
       MessageBox.Show("There is no way to calculate this route!");
       routeService.CloseAsync();
       routeService.Abort();
      }
     }
     catch (FaultException fe)
     {
      MessageBox.Show(fe.Message);
     }
      catch (Exception ex)
     {
      MessageBox.Show(ex.Message);
     }
    }
    

     



    Sunday, April 10, 2011 7:11 PM
  • One solution I found is to suppress faults:

    RouteService.RouteRequest routeRequest = new RouteService.RouteRequest();
    ExecutionOptions executionOptions = new ExecutionOptions();
    executionOptions.SuppressFaults = true;
    routeRequest.ExecutionOptions = executionOptions;
    

    • Proposed as answer by naic Tuesday, June 21, 2011 9:32 PM
    • Marked as answer by Ricky_Brundritt Thursday, August 1, 2013 12:44 PM
    Tuesday, April 26, 2011 8:09 PM