我使用下面给出的代码在Bing Maps上绘制路线。当系统直接连接到Internet时,它在仿真器上工作正常。但当我在我公司的第二行代码的代理服务器上时,它会抛出异常说法:需要代理授权:407
BingMaps.RouteService.RouteServiceClient routeService = new BingMaps.RouteService.RouteServiceClient("BasicHttpBinding_IRouteService");
BingMaps.RouteService.RouteRequest RouteReq = new BingMaps.RouteService.RouteRequest();
RouteReq.Credentials = new BingMaps.RouteService.Credentials();
RouteReq.Credentials.ApplicationId = ((ApplicationIdCredentialsProvider)Map.CredentialsProvider).ApplicationId;
RouteOptions rOptions = new RouteOptions();
rOptions.Mode = TravelMode.Driving;
rOptions.Optimization = RouteOptimization.MinimizeDistance;
RouteReq.Options = rOptions;
RouteReq.Options.RoutePathType = BingMaps.RouteService.RoutePathType.Points;
// Set the waypoints of the route to be calculated using the Geocode Service results stored in the geocodeResults variable.
RouteReq.Waypoints = new System.Collections.ObjectModel.ObservableCollection<Waypoint>();
foreach (Waypoint wp in WPList)
{
RouteReq.Waypoints.Add(wp);
}
//routeService.ClientCredentials = new System.ServiceModel.Description.ClientCredentials( new NetworkCredential("461167", "July@2012", "india");
routeService.CalculateRouteAsync(RouteReq);
routeService.CalculateRouteCompleted += new EventHandler<CalculateRouteCompletedEventArgs>(RouteService_CalculateRouteCompleted);
我明白我需要设置代理但是,我无法弄清楚如何。由于未配置RouteService,因此请接受代理凭据。
此外,互联网在模拟器上工作正常,我还在模拟器上设置了代理凭据。
请建议如何操作或不可能,因为它没有使用模拟器的代理凭据,甚至没有使用存储在系统上的凭据。