我正在使用 bing 网络服务来查找两个地方之间的最短路线。
但我得到了这个奇怪的错误:
public imagine_cup.RoutingService.RouteResponse EndCalculateRoute(System.IAsyncResult result) {
object[] _args = new object[0];
imagine_cup.RoutingService.RouteResponse _result = ((imagine_cup.RoutingService.RouteResponse)(base.EndInvoke("CalculateRoute", _args, result))); //error in this line
return _result;
}
该错误表明它是服务器错误。
这是我的代码:
public void CalculateRoute(List<Pushpin> wayPoints)
{
// Set the credentials.
routeService.RouteRequest routeRequest = new routeService.RouteRequest();
routeRequest.Credentials = new Credentials();
routeRequest.Credentials.ApplicationId = _applicationId;
// Return the route points so the route can be drawn.
routeRequest.Options = new routeService.RouteOptions();
routeRequest.Options.RoutePathType = routeService.RoutePathType.Points;
// Set the waypoints of the route to be calculated using the Geocode Service results stored in the geocodeResults variable.
routeRequest.Waypoints = new System.Collections.ObjectModel.ObservableCollection<routeService.Waypoint>();
//Adding way points
foreach (Pushpin ps in wayPoints)
{
routeRequest.Waypoints.Add(PushpinToWaypoint(ps));
}
// Make the CalculateRoute asnychronous request.
_routeService.CalculateRouteAsync(routeRequest);
}
我已经更新了我的 bing maps 密钥,所以原因不是旧密钥