Posts

Showing posts from 2011

Catastrophic Faillure and Delay Notification issues with WCF

Image
Before adding some new functionality to a customer’s existing site, my development runtime environment would hang, throw a timeout exception and after about a minute later a Catastrophic Failure message would appear. I also noticed a Visual Studio icon appeared in my system tray giving me a Delay Notification message. So I set break points at the entry points of the possible services having an issue but the code would never get executed.   After turning on Service Tracing and sifting through tons of information, I found the issue and saw this in the Tracing Viewer (bold text below is key): <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">             <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">                         <EventID>458797</EventID>                         <Type>3</Type>                         <SubType Name="Information">0</SubType&g

http Downloading Files and Browser Issues

While working on a project, I needed to download a document from the database and stream it to the client.  Our standard browser was IE 7+ and the standard code implementation documented throughout many forums the following with the first line simply obtaining the file via a service:   byte[] fileContents = csc.GetFileContent(this.CurrentContentId); Response.ClearContent(); Response.ContentType = this.ContentType; Response.AddHeader("content-disposition", string.Format("attachment;        filename={0}", this.ContentFileName)); Response.AddHeader("content-length", fileContents.Length.ToString()); Response.BinaryWrite(fileContents); Response.Flush(); Response.End();  The " Response.End() " at the end will cause a ThreadAbort exception within IE and other browsers.  The solution to this was to wrap this code inside a try-catch block and absorb the ThreadAbortException as follows: try  {    //code above here } catch