Introduction
This is one of those issues which is tricky and can happen
for a lot of reasons- and the troubleshooting process was very interesting. So
I thought of sharing my experiences hacking this down.
The issue never happens on our development machines, and
strangely it was happening only on one deployment machines [Windows Server 2008 R2, IIS
7.5, .NET 3.5 and I.E 8].
Background
We have a standard asp.net application with a few grids which are built using the Telerik RadGrid control.
How do you notice the issue?<o:p>
- None of the Telerik controls are working
properly [Row selection, column selection navigation, etc does not work]
- On a page which has a Telerik control, you will
see a “Done with errors” message on the status bar of IE (which we can easily
miss)
If we happen to see the above javascript error
and click on it, a popup will open up “Sys is undefined”
How do you go about the issue?
A basic understanding of ASP.NET Ajax and ScriptManger
controls will give you a hint on where to look. ASP.NET AJAX and Telerik
controls rely on a lot of embedded resources (CSS, Javascript files, etc) that
are dynamically loaded from an assembly at runtime. The ScriptManger or the
RadScriptManager controls does exactly that. These controls rely on the
webResource.axd http handler to do the job. Sys is the namespace of many
classes of the AJAX related javascript files loaded at runtime. So obviously there was some
problem loading the embedded resource.
So this can happen if the webResource.axd is not doing
its job correctly<o:p>
Now this is something very rare that can happen. So I looked
at the HttpHandler section of the IIS > Default WebSite. The *.axd entry is
there and is mapped to the right dll (aspnet_isapi.dll)
It may also happen if the web.config of our application is
not properly configured for using ASP.NET Ajax. So I checked all those entries
– everything looked fine. I also made sure that all the Telerik controls
related web.confg sections are available. I even found a website
that talk about this specific error and common resolutions. I tried all of them
applicable, but nothing worked.
I checked the application log file, event log - nothing is
logged.
One of the sections in the above mentioned website talks about an authentication issue with
RadScriptManager. Though, I added the proper authentication entries in the
web.config, it still did not work. Then I thought of simply replacing the whole RadScriptManager control with a normal asp.net ScriptManager and give a try and BINGO! It
worked.
But the issue was still baffling me – RadScriptManger is close
to a wrapper around the asp.net ScriptManager. Ideally if the later works, the
former one should also work – unless there is some issue internally. But this
would have easily manifested in the development machines as well.
Enabling the Failed Request Tracing in IIS
Now I thought of enabling the Failed Request Tracing in IIS.
This will give me some hint on why a request has failed. We can enable this
Failed Request Tracing in the IIS by following certain
steps.
Once this was done I started getting log files in
C:\inetpub\logs\FailedReqLogFiles. Looking at the log files, it was clearly
stating that there was some issue requesting for Telerik.Web.UI.WebResource.axd,
and strangely the error status code was 500 – which means that it crashed
somewhere on the server side. When I looked for more details in the log file,
it gave me more insight to the actual problem:
[ArgumentOutOfRangeException: Specified argument was out
of the range of valid values. Parameter name: utcDate]
What this means there was some issue parsing a date which
was passed as a query string parameter with the Telerik.Web.UI.WebResource.axd request. When I
searched for this error, one of the telerik
website said something like this:
“The assembly containing the embedded resources is
probably built in the future (its last modified time is later than the current
time). This can occur when deploying in a different time zone.”
This was strange - yes the deployment machine was in a different time zone, but how ever you calculate, I could have never built it in a future date compared to the Deployment machine!, how can this ever happen?! .. Unless the
deployment machine time itself was wrong – I checked it and there it was - the time was set to 16-Aug-2011
instead of 16-Aug-2012! (I did the whole thing on 16th Aug 2012)
I corrected the date on the machine and refreshed the page - the error was gone!
<o:p>
Points of Interest
While troubleshooting this problem, I was always convinced that it was some issue either in the IIS or the application web.config. I even thought it was some IE compatibility issue. Finally after getting the root of the issue, it just a simple date-time settings change in the deployment machine.
History
None