0
我在我的应用程序中收到此错误。我在错误日志中经常看到这些错误,但我不确定源代码。 以下是错误的堆栈跟踪。异常(消息):远程主机关闭了连接。错误代码是0x800703E3
Exception (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.Mvc.FileContentResult.WriteFile(HttpResponseBase response)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
但做了一些谷歌上搜索我发现,原因可能是我下载文件的方式,但我不知道之后。这里也是源代码。
string Id = id.Split(new[] { '!' }).First();
DocumentInfo Content = Doc.ContentDownLoad(Settings, docId);
Response.Clear();
Response.BufferOutput = false;
fileName = Content.DocName + "." + Content.FileExtn;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
return File(Content.Content, Content.MimeType);
我在这里尝试了一些建议的解决方案,但没有任何工作。有人可以提出一个可行的解我在这里做错了什么?
你能详细说明你试过的吗? – Tommy
我之前和之后使用的视图开始使用FileResult,然后我尝试使用Response.Flush()但静静地获取错误 – Sri
这是一个公共服务器? –