Wednesday, July 4, 2012

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name:utcDate

We got this error when we try to configure a new web server to deploy an ASP.Net application. The application was working fine in other environments but giving a Javascript error “WebResource.axd 'WebForm_PostBackOptions' is undefined” and not working as expected in the new environment. 






















Even though the Javascript error was not descriptive enough to find out the root cause, there was another error logged in the Event Viewer in the same time:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: utcDate
























We did a bit of search on this error and found out the issue. The issue was some assemblies were dated in the future. This happened due to the wrong date time configuration in the server. The server was a fresh install and the date time wasn’t set properly. .NET was installed before correcting the time. But once the server is connected to the domain, it has taken the correct date time, but DLLs were still dated in the future. That is the reason for WebResource.axd Javascript error. With every ScriptResource.axd request there are two parameters being passed 'd' and 't'. The 'd' parameter is the data and the 't' parameter is the time which the resource was built.
It seems like the datetime in this case is obtained from the last write date of the System.Web.Extensions.dll or System.Web dll. Therefore there were suggestions in the Web to change the file created and modified date on these DLLs in the GAC.

But in our case we had to reinstall the .NET framework to fix the issue!

No comments: