3

We use Service stack, and run using the InProcess model on .net core.

We have some longer running requests, which we would like to timeout - however, I am struggling to do this. Before .net core, you could configure the httpRuntime's "executionTimeout" however, this is unavailable in .net core. The new way of doing this (I believe) is to use the "requestTimeout" in the config - but Microsoft's website claims this is not supported with the InProcess model. If feels like the only solution left is to configure this in Service Stack somewhere, but I am not seeing anywhere obvious.

Am I missing something here? Is there a ServiceStack option to force the thread to finish on a timeout, or is this just not not possible?

There are other timeout options via IIS, but none which will stop the execution

Thanks

1 Answer 1

1

ServiceStack operates as a library handler on the .NET HTTP Worker Request thread, i.e. it doesn't spawn or manage any of its own threads. Any request quota limits or timeouts would need to be configured on the underlying HTTP Server, i.e. just as any other ASP.NET Core App would need to do.

If you're using IIS, you can still configure ASP.NET Core Request Timeouts in Web.config in the <aspNetCore/> tag. If you're using the default Kestrel HTTP Server you can configure its limits when configuring your Web Host.

Sign up to request clarification or add additional context in comments.

3 Comments

But if you are using In Process model with .net core 3.1 the requestTimeout will not work. Would you therefore have to implement this via middleware?
@strickt01 Given one of the primary ASP .NET Core authors suggests it would be difficult to implement via middleware I wouldn't recommend it. Don't know if there is an optimal solution, maybe you could run long running requests in a new Thread then cancel that.
Unfortunately, the inprocess model ignores the request timeouts ( github.com/dotnet/aspnetcore/issues/23160 ) so we are stuck until we move to Kestrel. Thanks for your help mythz - was afraid that would be the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.