Timeout issue at Azure Scheduler

Found an issue on implementing service execution using Windows Azure Scheduler. The triggered call is a long running one. Scheduler times-out after 60 seconds, as waiting for response to request made by the job.

The solution I came out with, for my situation, was to modify service code (Web API), making method call asynchronous, so execution of the action method called by Scheduler job request continues and finished on time.

This is the code I used for calling the method asynchronously, at the Web API action method:

Task.Factory.StartNew(() => MyMethodClass.MyStaticMethod(parameter));

Details: http://social.msdn.microsoft.com/Forums/en-US/46f56a6f-204a-416f-b267-b558dbeeffa2/how-to-change-the-timeout-for-azure-scheduler-job?forum=azurescheduler

Cheers,

Danfer.

3 thoughts on “Timeout issue at Azure Scheduler

  1. Danfer,

    I am having the same issue. Was it enough to mark your webapi method with the async keyword and have it return a Task to get past this? I have tried to do the same thing, but I still get a timeout with a job failure and the default 5 retries.

    Have you completely wrapped up your entire api method code in the TaskFactory.StartNew() syntax and simply returned that like this:

    return await TaskFactory.StartNew(() => MyMethod()); ?

    Thanks,
    Matthew

    • Hi Matthew,
      Sorry for late reply. The action is a regular one, nothing special on it.
      Here is the complete, simplified for showing here, code for the action:

      [HttpGet]
      public void AddItemAsync(string myParam)
      {
      Task.Factory.StartNew(() =>
      MyRepository.MyMethod(myParam));
      }

      Best regards,
      Danfer.

Leave a Reply

Your email address will not be published. Required fields are marked *