.net core 7 web api very slow first call more that 32s

Pedro Manuel Moço Ramalho 11 Reputation points
2023-01-23T10:36:52.5+00:00

Hi,

I have a problem in EF7 with core 7 web api. The first call take more that 30s and the second call take 60ms what is good. Any solution for that?

Thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,005 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Pedro Manuel Moço Ramalho 11 Reputation points
    2023-01-27T12:14:21.9433333+00:00

    Hi,

    I try but nothing at this time is soluction for problem, I have de same call in Framwork 4.7 and work well in the same server.

    Any sugestion?

    Thanks

    1 person found this answer helpful.

  2. Srivastava, Prashant 1 Reputation point
    2023-01-31T09:31:49.22+00:00

    @Pedro Manuel Moço Ramalho you might wanna check first the sequence of middleware you are calling to see what all kinds of middleware you have in call hierarchy and before it actually make a call to your end point what you are doing (starting from Startup.cs ) which is when you launch the API or say make the very first call to API.

    0 comments No comments

  3. Aravind Kumar Eriventy 0 Reputation points
    2023-04-05T09:16:45.8933333+00:00

    I think the issue is with DotNet Core, I had the same issue in one of my projects, The first call from dotnet core is taking more time to respond to, but this is not the case from Framework 4.7, both projects are having the same code, the same middleware and the same layers. To solve the issue I used app.UseResponseCompression, and added Microsoft.AspNetCore.ResponseCompression NuGet package into my project and configured it in the Startup class. The above solution works fine only for a day,
    I don't know why taking more time to respond using the Dotnet Core.