title: HttpSelfHostServer optimization
body: <p>I hope you can provide some help or info with HttpSelfHostServer.</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/system.web.http.selfhost.httpselfhostserver(v=vs.118).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/system.web.http.selfhost.httpselfhostserver(v=vs.118).aspx</a></p>
  
  <p>we have implemented above server in service app, used custom DelegatingHandler which we added to HttpSelfHostConfiguration MessageHandlers and override base SendAsync function where the message is processed</p>
  
  <pre><code>async Task&lt;HttpResponseMessage&gt; SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  </code></pre>
  
  <p>now everything works fine, fast but at some point after 20h there is a glitch on server where it stops processing message for 40s and after that it processes all the message + one that were queued from that point. after that it starts to work normal.it was like the queue on HttpSelfHostServer was full, can't find a way to trace this.</p>
  
  <p>clients which are querying the service is java http ajax post to the service every 100ms, requesting some status, json data.</p>
  
  <p>if there some limits in above web server which can be changed, like Max Concurrent Sessions, Max Concurrent Calls, and Max Concurrent Instances... or did someone had same or similar issue</p>
  
  <p>note:OS is Server 2012 r2, tried to change the host servers but same problem</p>