i have a simple webapi. It only makes a getasync call to a third party WS(in the code i put a dummy WS that you can try).
[HttpGet]
public async Task<List<string>> DemoStack()
{
List<string> nros = new List<string>();
nros.Add("1");
nros.Add("2");
nros.Add("3");
nros.Add("4");
nros.Add("5");
List<string> request = new List<string>();
foreach (string nro in nros)
{
using (HttpClient client = new HttpClient())
{
client.Timeout = Timeout.InfiniteTimeSpan;
string path = string.Format("https://jsonplaceholder.typicode.com/posts/{0}", nro);
string startdate = DateTime.Now.ToString();
HttpResponseMessage response = await client.GetAsync(path);
string rta;
if (response.IsSuccessStatusCode)
{
rta = "OK" + response.ReasonPhrase;
}
else
{
rta = "Error" + response.ReasonPhrase;
}
string enddate = DateTime.Now.ToString();
request.Add(string.Format("GET:{0}, Start:{1}, End:{2}, Rta:{3}", path, startdate, enddate, rta));
}
}
return request;
}
I added the line
client.Timeout = Timeout.InfiniteTimeSpan;
to just avoid timeout in IIS 8.5 with my real WS.
Answer of this webapi from an IIS 7 and 7.5
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><string>
GET:https://jsonplaceholder.typicode.com/posts/1, Start:24/11/2016 07:17:40 p.m., End:24/11/2016 07:17:40 p.m., Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/2, Start:24/11/2016 07:17:40 p.m., End:24/11/2016 07:17:40 p.m., Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/3, Start:24/11/2016 07:17:40 p.m., End:24/11/2016 07:17:41 p.m., Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/4, Start:24/11/2016 07:17:41 p.m., End:24/11/2016 07:17:41 p.m., Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/5, Start:24/11/2016 07:17:41 p.m., End:24/11/2016 07:17:41 p.m., Rta:OKOK</string></ArrayOfstring>
Answer of this WebApi from an IIS8.5:
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><string>
GET:https://jsonplaceholder.typicode.com/posts/1, Start:24/11/2016 19:21:34, End:24/11/2016 19:21:35, Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/2, Start:24/11/2016 19:21:35, End:24/11/2016 19:21:50, Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/3, Start:24/11/2016 19:21:50, End:24/11/2016 19:22:05, Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/4, Start:24/11/2016 19:22:05, End:24/11/2016 19:22:20, Rta:OKOK</string><string>
GET:https://jsonplaceholder.typicode.com/posts/5, Start:24/11/2016 19:22:20, End:24/11/2016 19:22:35, Rta:OKOK</string></ArrayOfstring>
As you can see, using this dummy WS the WEBAPI i have a delay of 15 seconds between calls in IIS8.5, but in IIS7.5 is just 1 second.
With my real WS, the delay between calls is 5 minutes and in IIS 7.5 the difference between start and enddate is just 1 second too.
In both scenaries, the first response get answered in 1 second, the problem is with the next request.
Thanks in advance.