Originally published on my old Charteris blog

We were deploying some assemblies last week that were built in the UK on Friday afternoon and were being copied immediately to a US server. Some of these assemblies contained ASP.NET Ajax components and some of the pages in the website used these and some of the AjaxControlToolkit.

Preliminary tests showed that something was up and requests for Javascript files being served out of the previously mentioned assemblies were being returned with a HTTP 500 status code(internal server error).

Looking at the response in Firebug I could see the call stack was pointing towards

  1. System.Web.HttpCachePolicy.UtcSetLastModified
  2. System.Web.Handlers.ScriptResourceHandler.PrepareResponseCache
  3. System.Web.Handlers.ScriptResourceHandler.ProcessRequest
  4. System.Web.HttpApplication.ExecuteStep

 

With an ArgumentOutOfRangeException being thrown. After taking a look with Reflector I hit my favourite search engine and found this excellent blog post. The gist is that the System.Web.Extensions code was getting the last modified DateTime from each assembly and using that to build the Cache entry. In the code that sets the Cache policy's LastModifiedDate it checks

 

if (utcDate > DateTime.UtcNow)
{
   throw new ArgumentOutOfRangeException("utcDate");
}
 

Our assemblies were all greater than the US server's UtcNow so we kept seeing the ArgumentOutOfRangeException. The temporary solution was for us to use a File Touch utility such as TouchPro to change the modified date to something the US server was happy with.