We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Re: The I/O operation has been aborted because of either a thread exit or an application request

    Jan 28, 2011 05:47 PM|arvestal|LINK

    OS: Windows Server 2008 64bit

    IIS 7

    Things I've tried, etc 

    1. I'm not using viewstate

    2. I'm not closing the browser and I'm waiting for the process to complete

    3. I have the patch installed.

    Below is my code, I only have 1 user and it blows up on the BinaryWrite.

    ErrorMessage: The remote host closed the connection. The error code is 0x80070057.

    ViewFileHandler.ashx::201010131034ARV RecipeId: 12  Stack::   at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)    at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()    at System.Web.HttpResponse.Flush(Boolean finalFlush)    at System.Web.HttpResponse.Flush()    at System.Web.HttpResponse.End()    at ViewFileHandler.ProcessRequest(HttpContext context) in d:\Web\projects\recipes\ViewFileHandler.ashx:line 133

    public void ProcessRequest (HttpContext context)
    {
        string id = context.Server.UrlDecode(context.Request.QueryString["recipeId"].ToString());
       
        MemoryStream ms = GetRecipeStream(id);
        byte[] recipe = ms.GetBuffer();
       
        try
        {
            context.Response.Clear();
            context.Response.Buffer = false;
            context.Response.ContentType = "Application/pdf";
            context.Response.BinaryWrite(recipe);
        }
        catch (System.Threading.ThreadAbortException)
        {
        }
        catch (System.Runtime.InteropServices.COMException)
        {
        }
        catch (Exception ex)
        {
            if (IsLoggerOn)
            {
                List<string> data = new List<string>();
                data.Add("ViewFileHandler.ashx::201010131034ARV");
                data.Add("RecipeId: " + id);

                Logger log = new Logger("ProcessRequest", data, ex);
                log.LogException();
            }
        }
    }

    public bool IsReusable
    {
        get {
            return false;
        }
    }