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!

Sunday, July 17, 2011

The page has one or more asp:Content controls that do not correspond with asp:ContentPlaceHolder controls in the Master Page.

I kept getting this error in the design view:
The page has one or more <asp:Content> controls that do not correspond with <asp:ContentPlaceHolder> controls in the Master Page.
A few Google searches, this is what I found to work for me:
Setting
<title></title>
instead of
<title />
solved the problem.
http://forums.asp.net/t/1302708.aspx

Friday, July 1, 2011

Skype in the Windows 7 taskbar

Try searching Google to see how to get rid of the Skype icon off the taskbar.  There are mostly results that instruct changing the shortcut's Compatibility mode to SP2.  That sounds clever but Skype itself directly supports this.

Open Skype...
Click Tools in the menu bar...
Click the Options menu item...
a new window will open, click the Advanced button on the bottom left of the new window...

Skype should have a checkbox entry that says
"Keep Skype in the taskbar while I'm signed in."

Wednesday, June 29, 2011

UpdatePanel isn't working, ScriptManager seems to not be rendering?

Where to start... I was using RadAjaxPanel with a standard ListBox and AutoPostBack enabled.  After clicking the new ListItem, the event would not fire.  Turns out that the RadAjaxPanel I was using was out-of-date that I believe was targeting the .NET 2.0 Framwork.  This would be a good time to explore using the standard .NET 4.0 UpdatePanel.

I found several demos that worked on their own in a new 4.0 project.  However when adding the demo code to our existing project, it didn't work.   The project had been updated from 1.1, to 2.0 to now 4.0 and it might have  even been upgraded from 1.0 to 1.1 - it's been around a while now.

I noticed that the demo's rendered HTML had a few things different from our implimentation of the demo.  Where the ScriptManager was at, the demo had:

<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('scriptMgr', 'form1', ['tupdatePnl','updatePnl'], [], [], 90, '');
//]]>
</script>

and a LOT more google searching, led me to checking over the Web.Config for proper entries:

Turns out I was missing this:

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>
and this had to be removed:
    <xhtmlConformance mode="Legacy"/>

Tuesday, June 28, 2011

View DOM Source

Often times the original View Source in a web browser is not sufficient for developers due to AJAX, jQuery, etc..  The developer tools in IE 8 (access by pressing F12) are pretty useful, but today I stumbled on View DOM Source.

Access it by View, Source, DOM (Page) - or press Ctrl+G

Thursday, May 26, 2011

VHD Corruption - Not cool, UGH.

Quick description of my setup... I do my dev work in VMs, in this particular case I have a Win7 host with my VM file on a Bitlocker partition.  I'm using Oracle VirtualBox to access a Win7 guest, that has like ~140GB dynamic drive, ~actual size 40GB.

While restoring a DB in SSMS 2008, the VM drive grows with the restore and fills the host drive.  Of course SSMS and the guest Win7 doesn't report being out of space, b/c technically the VM drive isn't out of space.  VirtualBox doesn't say it's out of space... why?  That's a good question, but if I could have saved a lot of grief if it threw up something like "Hey your VM is trying to write to the drive and it's out of space.  Your VM has been paused.  Retry?  Abort?"

Anyhow, VirtualBox along with everything else on my box is halting "This process is not responding..."

Not cool.  UGH.  More digging, I kill the VirtualBox task.  Restart VirtualBox.  Error with drive:

Failed to open the hard disk D:\abcde.vhd.
Could not get teh storage format of the medium 'D:\abcde.vhd' (VERR_NOT_SUPPORTED).
Result Code:
 VBOX_E_IPRT_ERROR (0x80BB0005)

Component:
 Medium

Interface:
 IMedium {1d578f43-5ef1-4415-b556-7592d3ccdc8f}

Callee:
 IVirtualBox {3f36e024-7fed-4f20-a02c-9158a82b44e6}



Immediately copy the broken VHD to an external drive.

Not cool.  UGH.  More digging, I try mounting the VHD in Win7...Start, Computer Management, Disk Management, Action, Attach VHD, and I get this:

The file or directory is corrupted and unreadable.

Not cool.  UGH.  More digging, I found a post about using WinImage (http://www.winimage.com/) to read the VHD.  So I open it in WinImage and woohoo it opened... except half my data is missing.  The C:\Users folder isn't even listed.

Not cool.  UGH.  More digging, I came across a bunch of other posts and disregarded them, then later wanted to go back to it but couldn't find them.  The gist of it was that a person fixed their corrupted header on their dynamic VHD by using a utility to convert it to a fixed size VHD.  The result should be that my 120GB dynamic VHD would result in a 40GB fixed size VHD.  They had a link to VHDTool (http://archive.msdn.microsoft.com/vhdtool) so I figured I'd give it a whirl.  Data should be intact and just have a new header.

Run the utility to convert to fixed size, seems ok, open in WinImage, files still there.  Mount in Win7, error.  VHD looks like one big blob of unformatted space.  Try VirtualBox... the VHD mounts, but it won't boot.  Makes sense.  It's now a fixed size VHD with 0 free bytes.  Mount to a diff VM as a secondary drive.  Boot, OS says the secondary drive needs to be formatted.

Not cool.  UGH.  More digging, but nothing new to try yet.  So I figure the VHD has a new header now, and I can see my data in WinImage... So I'll just try converting back to a dynamic drive again and see if I can then boot.

Guess what I learned.   WinImage has menus!  And under those menus are various little neat tricks... like.... Disk, Convert VHD image...

I convert the new fixed size VHD, to a dynamic VHD, WinImage shows the new data, but still missing C:\Users.  I try mounting in Win7, drive mounts!  VirtualBox media manager opens the VHD!  Boot the Win7 OS..... SUCCESS!!!! :)

Looking back, WinImage was able to see the contents of the original corrupted VHD, so maybe I could have used it to open the corrupt VHD and then immediately re-write it back out, without having to use the Microsoft tool.  If the VHD corrupts a 2nd time, then I'll try that ;)

Every blog needs a first post.

As a programmer, I *know* I should be contributing back to the community, but it's always been on the back burner.  I also *know* that I, like many other programmers, do not enjoy writing documentation.  Anyhow, I thought my most recent situation is worth documenting because wow I was in quite a pinch.  So... I guess it's time to start a blog!