Thursday, July 3, 2008

Weird ASP.Net deploy exception

Sometimes when you deploy an ASP.Net webapplication you might get this error in Application_Error from Global file:

Exception message:
Specified argument was out of the range of valid values. Parameter name: utcDate
Stack trace:
at System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate) at System.Web.HttpCachePolicy.SetLastModified(DateTime date) at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Made some Google search and realized this is caused by some 'bug' in the framework caused when you try to deploy a webapplication compiled on a machine to a different machine on a different regional time. For instance if you compile something in Romania and deploy it on a server from Denmark where the hour is with one unit back, you will get this error.
Webresource.axd won't load resources and other funny shits will occur related to CSS and other formatting (bizzare look of the web app).

To solve it, either compile with datetime changed on local machine or wait one hour to pass. NOT :)


esteewhy said...

Yeah, it seems to be my case. Don't you know, was it fixed in a final netfx35? (I suppose you were using beta1 at the time of writing, weren't you?)

Cosmin S said...

Sorry for such late answer, I'm not a passionate blogger. As I recall I was using the release version. (happened in production :) )