0

I'm trying to adjust the timeout for a single endpoint in my server. I do not need the time-out to be increased for any other section of the server, this particular endpoint just handles large requests sometimes.

[HttpPost]
    [Route("PreventativeMaintenance/Tasks/Route/{routeID}/Complete")]
    [ActionAuthorize("update")]
    public HttpResponseMessage CompleteRouteTasks(Guid routeID, RouteCompletedDto dto)
    {
      _taskService.CompleteRouteTasks(routeID, dto.TaskIDs, dto.CompletedOn);
      return Request.CreateResponse(HttpStatusCode.OK);
    }
Maxxxxxy
  • 1
  • 1
  • You can find some useful examples here https://stackoverflow.com/questions/24403832/timeout-a-web-api-request The idea is to run a task with a timeout, then await it or run synchronously – opewix Jan 10 '19 at 23:12
  • 1
    Be aware when using a timeout with tasks it doesn't stop the thread from running inside the task. Only the wait for the task stops waiting. – Silvermind Jan 10 '19 at 23:21
  • 1
    Thank you guys, both of these comments were very helpful. – Maxxxxxy Jan 10 '19 at 23:33

1 Answers1

0

Looking into the resources provided by Opewix and following some other thread links from there. I ended up going with:

System.Web.HttpContext.Current.Server.ScriptTimeout = 300;
Maxxxxxy
  • 1
  • 1