JAVAD SHEIKH
JAVAD SHEIKH

Reputation: 41

Why asp.net web api response gets too much time

I'm new to asp web API and I created a hello world HttpResponseMessage and I'm using postman for testing it, but on the first try, it takes 12385 ms to response.

Is that normal? if it's not then what is the problem?!

 public HttpResponseMessage Get()
    {
        HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, "value");
        response.Content = new StringContent("Hello world", Encoding.Unicode);
        response.Headers.CacheControl = new CacheControlHeaderValue()
        {
            MaxAge = TimeSpan.FromMinutes(20)
        };
        return response;
    }

Upvotes: 0

Views: 2647

Answers (1)

user1011627
user1011627

Reputation: 1811

If you are deploying to IIS and then testing via Postman, it is "normal" to experience a delay on the first request as IIS has to spin up the app to be able to service the request. Darin does a good job of explaining on this similar SO question.

First Web API session request is very slow

Upvotes: 1

Related Questions