RadGrid BIFF导出-远程主机强制关闭了现有连接
本文关键字:连接 主机 导出 BIFF 程主机 RadGrid | 更新日期: 2023-09-27 18:27:38
我运行的是刚刚从Windows 2008升级的Windows Server 2012 R2。
我有一个带有图像的Telerik
网格。我最近更换了服务器,现在我无法将网格导出到带有图像的biff。错误如下:
An existing connection was forcibly closed by the remote host
堆栈跟踪:
[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +249
[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +8420333
System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) +57
System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +243
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +470
System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) +8552078
System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) +230
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +645
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +9
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) +87
System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) +1467
System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) +84
System.Net.ConnectStream.WriteHeaders(Boolean async) +816
[WebException: The underlying connection was closed: An unexpected error occurred on a send.]
System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +3407972
System.Net.WebClient.DownloadData(Uri address) +214
Telerik.Web.UI.ExportInfrastructure.Image.GetImageFromUrl() +226
Telerik.Web.UI.ExportInfrastructure.XlsBiffRenderer.CreateWorksheet(Table tbl, Workbook wb) +2238
Telerik.Web.UI.ExportInfrastructure.XlsBiffRenderer.Render() +198
Telerik.Web.UI.Grid.Export.TableViewExporter.ExcelExportRenderForm(HtmlTextWriter nullWriter, Control form) +1057
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +151
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +49
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
System.Web.UI.Page.Render(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5363
这是一个动态创建的网格,它过去在旧服务器上工作。
我已经把它缩小到下面的代码。当我包含完整的URL(这是一个生成图像的ashx)时,它会失败。当我排除"https://www.someserver.com",它工作正常,但不导出BIFF中的图像。
GridImageColumn gci = new GridImageColumn();
gridPreview.MasterTableView.Columns.Add(gci);
gci.HeaderText = fieldName;
gci.UniqueName = fieldName.Replace(" ", string.Empty);
gci.FooterText = "image";
gci.DataImageUrlFormatString = string.Format("https://www.someserver.com/{0}{{0}}/w100/h100", cm.SiteInfo.FriendlyName);
gci.DataImageUrlFields = new string[] { fieldName };
gci.ImageWidth = 100;
gci.ItemStyle.Width = 100;
gci.HeaderStyle.Width = 100;
gci.AllowFiltering = false;
我花了一整天的时间在这个问题上拔头发,我需要一个快速的答案来解决这个问题。。。IIS 8中是否有服务器设置?我需要防止对映像的回调失败?当代码调用生成的图像时,它无法访问该图像(听起来很荒谬,但我现在正在抓住救命稻草),这是权限问题吗。
我试过增加超时时间(我怀疑这没有帮助,因为它很快就失败了)。我运行了一个调试会话,它在预呈现时崩溃了。使用JustDecompile深入研究Telerik,我发现它在预渲染器上发挥了作用,但我想我在寻找我缺少的东西。毕竟,如果它在一台服务器上工作,它应该在我移动到的服务器上工作吗?
它在标准Excel导出中工作得很好,但当然,图像不会被嵌入。
编辑:我使用旧数据库重新激活了旧服务器(图像仍从新服务器中提取),但同样失败。这排除了一切,除了Telerik从新服务器中提取图像的方式。我可能会回去,编辑包括图像在内的所有内容,看看错误是否发生了变化。
再次编辑:好吧,我在旧服务器上更改了所有内容,阻止错误的一件事是将图像URL更改为旧服务器上的本地URL。所以,这意味着这绝对与在新服务器上获取图像有关。苏-有什么区别?是DDOS保护吗?是权限吗?(编辑:不,不是——我用消防水管"每个人"读/写,同样的问题)这让我疯了。
事实证明,这是2015年代码中的一个错误。随着Telerik Tools 2016年第一季度的发布,这一问题似乎得到了解决。更新后,我现在可以在SSL中导出了。