我遇到了当今无法解决的问题。如果您分享您的意见,我会被征询的。
有关流文件的问题。
例如,用户来自带有QueryString参数的url,该参数标识要流式传输的文件。
然后,成功从数据库中读取文件。之后,我使用下面的代码流式传输并写入响应的输出
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();
}
最重要的是,我无法在调试环境中重现该错误。但是,当我将网站发布到服务器时,在事件查看器中我遇到了数千次错误。
在提供一些提示或类似信息的情况下,我共享了没有堆栈跟踪的事件日志,
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。 :我研究了此问题,服务器更新了sp 2和com port reset。它没有用。 我也读过有关IsClientConnected的信息,但是它目前在代码中。
任何帮助都会很棒,谢谢,