Tuesday, August 30, 2011

WebResource.axd returns 404 and then starts working after a while on it's own


Original question that I posted:

http://stackoverflow.com/questions/6902650/webresource-axd-wont-update

http://forums.asp.net/t/1711550.aspx/1?WebResource+axd+returns+404+and+then+starts+working+after+a+while+on+it+s+own
We have a library of common controls, and I'm attempting to steer towards using embedded resources in it for images, JS, and CSS. It seems that upon each deploy to TEST/PROD, there is a window of time where WebResource.axd is returning a 404. After that window of time expires, suddenly the page starts serving out content properly. On my local DEV machine it seems that there are times when I can compile and reload a page that is using embedded resources, and it immediately shows a difference. Other times it responds like there is a cache waiting to expire.
Things I've tried:
- browsing from different machines to rule out local caching
- iisreset
- net stop w3svc
- delete temp files from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files and C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
- killing the inetinfo.exe process
- killing the w3wp.exe process
- disabling IIS Output Caching
- copying the URL and adding in an extra false querystring parameter to mimic a new page request
- pressing Ctrl-F5 :)
It seems rebooting fixes the issue.
My google kung-fu has diluted results filled with everyone's answer to check the namespace. I am confident the namespace is correct. After a while the resource will start serving out properly and the correct version. And if it DOES serve at some point, it seems logical to me that the namespace must be correct.
Any ideas? What other information can I provide?
Thanks,
James
Michigan, USA
OK, WOW... FINALLY stumbled a solution.  Ready? This is going to be a long one :)

While trying to get more information, I load Fiddler and I'm looking at the headers... when I come across
this standard .NET error (edited):
<html>
    <head>
        <title>The resource cannot be found.</title>
[snip]
    </head>
    <body bgcolor="white">
            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
            <h2> <i>The resource cannot be found.</i> </h2></span>
[snip]
            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
            </font>
    </body>
</html>
<!--
[HttpException]: This is an invalid webresource request.
   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)
-->
<!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages
using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors
mode="RemoteOnly"/&gt; in production environments.-->
WHOA... there's a commented stack trace that is buried in the page?!?!  After a quick Google search and I come across a link to http://stackoverflow.com/questions/1096793/system-web-httpexception-this-is-an-invalid-script-resource-request and on that page I stumble across this comment by Rob Levine (http://stackoverflow.com/users/134754/rob-levine):
Believe it or not, if your dlls have embedded resources in them, and they are dated in the future this will happen (if you ever compile dlls in the UK and then immediately deploy them to US web servers you'll be well aware of this issue!). I can't remember the event log error this shows, but would know if I saw it - and it is not immediately obvious.
That is exactly the situation... I compile in Eastern Time, then deploy to Rackspace in Central Time.  After about an hour the resources begin to load again... it makes sense... the time stamps catch up!