0

I need help to understand where my time problem is. I have a winform/wpf application which communicate with a WCF service through a webapi 2 and a System.Net.Http.HttpClient.

Client => HttpClient => webapi => wcf service.

When I deploy this and run, it takes the first time very long time to get an answer back. But second time and more it is very fast.

If I don't run it for a while it sleeps again.

Why is it so slow in the beginning, what will I look at?

Roger Uhlin
  • 171
  • 1
  • 1
  • 8
  • Possible duplicate of [Why is the first WCF client call slow?](https://stackoverflow.com/questions/10859832/why-is-the-first-wcf-client-call-slow) – Ricardo Pontual Jan 11 '18 at 13:44
  • 1
    Use a sniffer like wireshark or fiddler and filter on the http messages which contains the time. Usually the first time a cookies is established and data is downloaded into the temporary IE folder on your PC. When you go to a website a 2nd time the IE automatically searches the temporary folder before download need data. – jdweng Jan 11 '18 at 13:59

1 Answers1

0

When first call WebApi will initzialize (IIS have to run Api, and by default ISS start api after first call). This take some time. And in IIS You have the default AppPool Idle Time-out (minutes) set to 20 minutes, so after 20 minutes app will go to sleep mode, and IIS have to wake up app. WebApi why 1st call is slow?

Almost the same problem is with WCF

WCF why 1st call is slow?

So in Your app you have problem with slow 1st api call, and after this you have problem with slow 1st wcf call. You have doubled the slow.

garret
  • 1,134
  • 8
  • 16