C# – WebResource.axd and ScriptResource.axd load very slowly

asp.netciisscriptmanager

Under normal circumstances the two .axd files load at normal speeds to the browser, i.e. a few hundred milliseconds. I can see them load normally along with all the other page elements by looking at the waterfall chart (network chart) in chrome or another debugging tool.

Occasionally some kind of issue occurs where the two files take about a minute to load. Here are a few other notes:

  • All other elements on the page load at normal speeds.
  • It generally occurs once or twice a day and lasts for a few minutes.
  • I can see Requests Queued spike on performance counters at the same time.
  • CPU, memory and disk all stay normal during this time.
  • Had one outage of a few hours today that required an application restart to resolve.
  • Not combining the .axd files or anyhing like that yet.
  • Have URL rewriting implemented site-wide. axd files are excluded from rewriting.
  • App built for C# 3.5
  • IIS 7
  • I’m using the CDN version of ScriptManager, eg:

    <asp:scriptreference name="MicrosoftAjax.js" path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js"></asp:scriptreference>

It looks like others have had a similar issue, but not solved:

WebResource.axd and ScriptResource.axd weird behaviour

WebResource.axd & ScriptResource.axd loading takes more than 1 minute

Question:

Any idea how to figure out what is causing these two files to load so slowly occasionally?

Also, are there any workarounds, such as prebuilding the .axd files or something..?

Best Answer

Maybe hosting http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js locally would help?