title: Async Controller Action Re-Called after one minute
body: <p>I have an action on an MVC3 Async Controller which processes csv files, the async part of which is as follows:</p>
  
  <pre><code>  [HandleError]
    [NoAsyncTimeout]
    public void UploadAsync(int jobId)
    {
        var timestamp = DateTime.Now;
        Log.Debug("UploadAsync " + timestamp);
  
        var job = _fileUploadService.GetJob(jobId);
  
        Log.Debug("AsyncManager.OutstandingOperations.Increment " + timestamp);
        AsyncManager.OutstandingOperations.Increment();
  
        var task = Task&lt;Job&gt;.Factory.StartNew(() =&gt; {
              Thread.Sleep(90000);
        });
  
        task.ContinueWith(t =&gt;
        {
           try 
           {
                AsyncManager.Parameters["Results"] = GetJobResultDetails(jobId);
            }
            //no "catch" block.  "Task" takes care of this for us.
            finally
            {
                AsyncManager.OutstandingOperations.Decrement();
            }
        });
    }
  </code></pre>
  
  <p>and the completed counterpart is:</p>
  
  <pre><code>  public JsonResult UploadCompleted(int jobId)
    {
        Log.Debug("UploadCompleted");
  
        try
        {
            return AsyncManager.Parameters.ContainsKey("Results")
                       ? Json(AsyncManager.Parameters["Results"],
                                  JsonRequestBehavior.AllowGet)
                       : Json("", JsonRequestBehavior.AllowGet);
        }
        catch (Exception ex)
        {
            ExceptionHelper.LogError(ex, Log, "message");
           return Json("");
        }
    }
  </code></pre>
  
  <p>This works fine when the ProcessJob(job) task takes less than a minute. After a minute, the same task is kicked off again on a separate thread, processing the same job as the one that is currently running. </p>
  
  <p>Is there anything obvious that I am missing around timeout settings for either async controller methods or Tasks that might cause this behaviour?</p>
  
  <p>EDIT-</p>
  
  <p>I swapped the call to the process job for a thread.Sleep for a minute and a half and when I looked in the log I can see that the UploadAsync has still been called twice so it is nothing to do with the code that ProcessJob executes.</p>
  
  <p>It is worth noting that this only happens when deployed to the integration server and not locally.</p>
  
  <p>Could there be an IIS setting that needs upping to accomodate the longer process time?</p>
  
  <p>EDIT - </p>
  
  <p>UploadAsync called with Ajax:</p>
  
  <pre><code> $(document).ready(function () {
      $("#JobIdToProcess").text(@Model.JobIdToProcess);
      var jobId = $("#JobIdToProcess").text();
  
      if (jobId.charAt(0)) {
        process(jobId);
      }
  });
  
  function process(jobId) {
      alert("process called");
      $.ajax({
          type: "GET",
          url: makeUrl('~@string.Format("/{0}/{1}", "FileUpload", "Upload")' 
                                                            + "/" + jobId),
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          beforeSend: function(xhr) {
              $(window).bind('beforeunload', function() {
                  xhr.abort();
              });
          },
          traditional: true,
          success: function (data) {
              var uploadResults = $.parseJSON(data);
              var completedDate = formatDate(uploadResults[0].CompletedDate);
  
              $("#CompletedDate" + jobId).html(completedDate);
          }
      });
  }
  </code></pre>