イメージングサービスを使用してビンマップからイメージを取得していますが、理由なくイメージングサービスを使用して終了することがありました。イメージサービスがmapuriリクエストタイムアウトを処理していないためです。ImageryService Unhandled TimeoutException
取得イメージ:
public static void GetBingMapImage(double longitude, double latitude, Size size, int zoomLevel, ImageryServiceParams imageResponseCallback)
{
var mapUriRequest = new MapUriRequest();
var location = new GeocodeLocation { Latitude = latitude, Longitude = longitude };
// Set credentials using a valid Bing Maps key
mapUriRequest.Credentials = new Credentials();
mapUriRequest.Credentials.ApplicationId = BingMapsKey;
// Set the location of the requested image
mapUriRequest.Center = new GeocodeLocation();
mapUriRequest.Center.Latitude = location.Latitude;
mapUriRequest.Center.Longitude = location.Longitude;
mapUriRequest.Pushpins = new ObservableCollection<ImageryService.Pushpin>();
mapUriRequest.Pushpins.Add(new ImageryService.Pushpin { Location = location, IconStyle = "10" });
// Set the map style and zoom level
var mapUriOptions = new MapUriOptions();
mapUriOptions.Style = MapStyle.AerialWithLabels;
mapUriOptions.ZoomLevel = zoomLevel;
// Set the size of the requested image to match the size of the image control
mapUriOptions.ImageSize = new SizeOfint();
mapUriOptions.ImageSize.Height = Convert.ToInt16(size.Height);
mapUriOptions.ImageSize.Width = Convert.ToInt16(size.Width);
mapUriRequest.Options = mapUriOptions;
var imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
imageryService.GetMapUriCompleted += ImageryServiceGetMapUriCompleted;
imageryService.GetMapUriAsync(mapUriRequest, imageResponseCallback);
}
応答ここに:
public MyApplication.ImageryService.MapUriResponse EndGetMapUri(System.IAsyncResult result) {
object[] _args = new object[0];
MyApplication.ImageryService.MapUriResponse _result = ((MyApplication.ImageryService.MapUriResponse)(base.EndInvoke("GetMapUri", _args, result)));
return _result;
例外:
「へのHTTPリクエストhttp://dev.virtualearth.net/webservices/v1/ imageryservice/imageryservice.svc 'が割り当てられたタイムアウトを00:01:00超えました。この操作に割り当てられた時間は、より長いタイムアウトの一部であった可能性があります。
リクエストの後にブレークポイントを置き、そこに1分ほど待って簡単に再現できます。私はこの例外を処理するために何をすべきか、私はすべてのソリューション、また、このトピックに関連した質問を見つけることができませんでした
...
私もここにこの問題について話している:http://forums.create.msdn.com/forums/p/103502/616465.aspx#616465
感謝あらかじめ。 getImageryCompletedイベントで例外を処理する