0
我已經編寫了一個Silverlight類來使用Bing地圖路由服務。我從緯度/長度數據創建Waypoint對象數組,我已經存儲在數據庫中,並將其發送到Web服務的CalculateRoute方法以獲取路由,但我無法成功返回路由。響應始終包含錯誤「處理請求時發生錯誤」。我很難過。關於如何解決這個問題或者至少從服務中獲得更有幫助的錯誤/異常的任何想法?以下是調用該服務的方法:Bing地圖路徑服務CalculateRoute返回「處理請求時發生錯誤」。
public void CalculateRoute(Waypoint[] waypoints)
{
request = new RouteRequest();
request.Waypoints = new ObservableCollection<Waypoint>();
for (int idx = 0; idx < waypoints.Length; idx++)
{
request.Waypoints.Add(waypoints[idx] as Waypoint);
}
request.ExecutionOptions = new ExecutionOptions();
request.ExecutionOptions.SuppressFaults = true;
request.Options = new RouteOptions();
request.Options.Optimization = RouteOptimization.MinimizeTime;
request.Options.RoutePathType = RoutePathType.Points;
request.Options.Mode = TravelMode.Walking;
request.Options.TrafficUsage = TrafficUsage.TrafficBasedRouteAndTime;
_map.CredentialsProvider.GetCredentials(
(Credentials credentials) =>
{
request.Credentials = credentials;
RouteClient.CalculateRouteAsync(request);
});
}
然後我有一個處理響應的回調,但我一直無法獲得成功的響應。我試圖確保maxBufferSize和maxReceivedMessageSize設置正確,超時設置正確,但無濟於事。任何幫助將非常感激。