Is it possible to set a maximum query(string) length for a single route/action in ASP.NET Core?
I have a search action that returns entities keyed with a Guid in the database. I have an requirement to return a number of them from the API, retrieved by Id. So I would like to modify the search action to allow a parameter [FromQuery]Guid[] EntityIds
, and then I could pass 10 or 20 (or whatever) Entity Ids to this search action. However, the API is failing because the querystring is too long. I know it can be set globally, but I was hoping there would be something like:
[HttpGet, MaxQueryLength(4000)]
public async Task<IActionResult> Search([FromQuery] Guid[] EntityIds)
So I don't have to change the whole API for this one request...?