dodyg / practical-aspnetcore

Practical samples of ASP.NET Core 9 RC1, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
MIT License
9.18k stars 1.18k forks source link

Create sample for RequestTimeout attribute #376

Closed dodyg closed 1 year ago

dodyg commented 1 year ago

Hi @dodyg. could you please show the code to use the RequestTimeout attribute? already registered the service using builder.Services.AddRequestTimeouts() and app.UseRequestTimeouts(). but when I try to use the attribute in the controller, it doesn't seems to work

[RequestTimeout(milliseconds: 1)]
public override IActionResult GetList()
{
//...
}
dodyg commented 1 year ago

https://github.com/dodyg/practical-aspnetcore/blob/net6.0/projects/.net8/request-timeout-4/Program.cs

dodyg commented 1 year ago

https://github.com/dodyg/practical-aspnetcore/tree/net6.0/projects/.net8/request-timeout-5