I faced a problem that i couldn't solve nowadays. If you share your opinions, i'll be appriciated.
The problem about streaming file.
For example, user comes from url with a queryString parameter that identify the file to stream.
And then, read the file from database succesfully. After that, i use below codes to stream and write into response's output
try
{
do
{
read = reader.GetBytes(6, offset, chunk, 0, chunk.Length);
if (read > 0)
{
if (streamParam.Context.Response.IsClientConnected)
{
streamParam.Context.Response.OutputStream.Write(chunk, 0, (int)read);
streamParam.Context.Response.Flush();
offset += read;
}
else read = -1;
}
}
while (read > 0);
}
catch (Exception exc)
{
streamParam.Context.Response.End();
}
The most important thing is, i can't reproduce the error in debugging environment. But when i publish the website to server, i faced errors thousands times in Event Viewer.
I Shared the event log without stack trace in case of provide some tips or something like that,
System.Web.HttpUnhandledException Page: file_streamer.aspx?fId=12312 Message: Exception of type 'System.Web.HttpUnhandledException' was thrown. StackTrace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at webproj.file_streamer_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Source: System.Web InnerException:
System.Web.HttpException (0x80004005): An error occurred while communicating with the remote host. The error code is 0x800703E3. ---> System.Runtime.InteropServices.COMException (0x800703E3): The I/O operation has been aborted because of either a thread exit or an application request. (Exception from HRESULT: 0x800703E3)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) An error occurred while communicating with the remote host. The error code is 0x800703E3.
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) DataDll The I/O operation has been aborted because of either a thread exit or an application request. (Exception from HRESULT: 0x800703E3)
P.S. : I researched it, server updates sp 2 and com port reset. It didn't worked. Also i read about IsClientConnected but it's currently in the code.
Any help will be great, thanks,
User contributions licensed under CC BY-SA 3.0