Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:35:25+00:00 2026-06-03T20:35:25+00:00

I am using imagery service to get an image from bing maps, and from

  • 0

I am using imagery service to get an image from bing maps, and from time to time my apllication used to quit without a reason, I figured out that it’s because imagery service is not handling the mapuri request timeout.

Get Image:

    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);
    }

Response here:

        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;

The exception:

The HTTP request to ‘http://dev.virtualearth.net/webservices/v1/imageryservice/imageryservice.svc&#8217; has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.

You can easily reproduce this by putting a break point after the request and waiting there about a minute or so.

What should I do to handle this exception, I didn’t find any solution, nor question related to this topic…

I’m also talking about this problem here: http://forums.create.msdn.com/forums/p/103502/616465.aspx#616465

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:35:26+00:00Added an answer on June 3, 2026 at 8:35 pm

    Handling the exception in the getImageryCompleted event seemed to fix this problem:

            private static void ImageryServiceGetMapUriCompleted(object sender, GetMapUriCompletedEventArgs e) 
            { 
    // This is where you want to handle the timeout or web service errors.  This will prevent
    // the error that the debugger stops on from getting back to the main thread and from your
    // application having an UnhandledException.
    try
    {
                if (e.Result == null) return; 
    
                var imageryServiceParams = e.UserState as ImageryServiceParams; 
                if (imageryServiceParams != null) 
                    imageryServiceParams.ImageResponseCallback.DynamicInvoke(new ImageryServiceResult(new Uri(e.Result.Uri, UriKind.Absolute)) { UserState = imageryServiceParams.UserState }); 
              }
    catch
    {
    // The "MessageBox.Show is in a try/catch since it throws an exception if it is called when another
    // MessageBox.Show is open. This was at least the case in Pre-Mango releases.
    try { MessageBox.Show("Caught the TimeOut or WebException.  Application still running."); }
    catch {}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Android 2.1+. I have a service that gets killed from time to time
I'm drawing multiple 'pages' of imagery using a CGContext in the iOS. I've used
I am using image upload and resize script from someones blog. It stores the
I'm trying to get rgb color info from every pixel using imagecolorat() and I'm
Using Browserlab, it appears that the background image is not centred in Firefox7 for
I want to upload an image from disk, resize it, and then upload it
Using android 2.3.3, I have a background Service which has a socket connection. There's
I get the following error when writing a thumbnail image to the below directory
i am using this code to create watermark. $image = '1.jpg'; $overlay = 'stamp.png';
I'm trying to create map (using the Google Maps JavaScript API V3 ) which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.