IIS serving static content gives 503 at random

iisiis-7.5

We're having a few issues with our image server.

It's a Win 2008 running IIS 7.5 and it only serves static content: images.

It has run without issues for quite a while, until recently when we disabled Output Caching, as we noticed having it enabled meant it sent no-cache host-headers to the clients (forcing them to fetch the images from the server every time)

We've read quite a bit about it, and it seems IIS just works that way – either you use Output Caching or you get to use cache host-headers.

Anyway having disabled the Output Cache, we now experience random 5 minutes intervals, where all requests just get a 503 Service Unavailable. During this period the "Files cached" performance counter staggers (neither increased nor decreased) and after the period all caches are flushed.

You might find it weird I talk about caching, since we disabled Output Caching.

The thing is we changed the ObjectTTL parameter in registry, so we cache files for 3 minutes (which has worked very well, our Disk I/O dropped significantly)

So even with Output Caching disabled, we're still caching plenty of files – if we could just get rid of the random 503 it'd be perfect 😀

We don't get any messages in the Windows event log during these 503 intervals, so we're pretty stumped as to what to do.

Any ideas are very welcome 🙂

Best Answer

Maybe the problem are the RequestQueue/ConcurrentRequest limits. Consider the settings of the accepted answer on this Stack Overflow question:

IIS 7.0 503 errors with generic handler (.ashx) implementing IHttpAsyncHandler

To eliminate the 503 errors required 3 different config changes:

machine.config:

<configuration>
...  
   <system.web>  
    ...  
      <processModel enable="true" requestQueueLimit="100000"/>

IIS Manager > ApplicationPools > Advanced Settings

Queue Length : 65535

and finally (the missing piece of the puzzle), the command line:

appcmd.exe set config /section:serverRuntime /appConcurrent