0

I need to run a 1-time long-running operation (around 10 minutes) via a ServiceStack service. I run this all on my local machine with ServiceStack running on IIS and .NET 5. Now it gives a timeout and I have no clue what is the cause (I also checked my IIS settings by the way). Part of my code (I removed some not relevant code):

static async Task Main(string[] args)
{
   var jsonServiceClient = new JsonServiceClient("http://localhost/services");
   jsonServiceClient.Timeout = TimeSpan.FromMinutes(20);
   await CorrectCreationDates(jsonServiceClient);
}

private static async Task CorrectCreationDates(JsonServiceClient jsonServiceClient)
{
   var request = new CorrectCreationDatesRequest();
   var result = await jsonServiceClient.PostAsync(request);
}

This is the exception:

System.Net.WebException: 'The operation has timed out.'

This exception was originally thrown at this call stack: ServiceStack.AsyncServiceClient.SendWebRequestAsync(string, string, object, System.Threading.CancellationToken, bool) in AsyncServiceClient.cs System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Gloneco.Importer.Program.CorrectCreationDates(ServiceStack.JsonServiceClient) in Program.cs System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.GetResult() ... [Call Stack Truncated]

  • 10 minutes is a long time for a web request. Should it be handled some other way? – mjwills Dec 24 '20 at 23:55
  • I know, but it is also a test case: Are these kind of batch-like processes possible using REST services. But you are right I could reuse the repository logic in the console and skip the REST service layer. Another reason is I like to add later admin like services to a website which could take more time. – Evert Wiesenekker Dec 25 '20 at 00:03

1 Answers1

0

ServiceStack doesn't impose any request limits itself, any limits are imposed by the underlying HTTP Server, e.g. if you're using IIS checkout the How to increase request timeout in IIS answers.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • 1
    Many thanks! I completely looked at the wrong place: I checked the application pools! Also because my REST services are configured as an application under the main website I could not find the timeout setting, but it was (of course) a setting of the main website. – Evert Wiesenekker Dec 25 '20 at 08:13