We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Failed Network Error When Downloading Excel File

Hi,

We have a web application that allows a user to upload an Excel file. We then process the file in memory with the Aspose.Cells component for .Net and then use the Save function (to a response) to download it again to the user. This has been working great for almost 5 years. However, in mid-December, many of our customers have started receiving the Failed Network Error instead of the file downloading successfully. Yesterday, I rolled back the version of Aspose.Cells to the November release (20.11.0) from the current release of 21.2.0. That did not fix the issue. This does not happen for all users (including me) but it does happen for most users. We have seen the issue in Chrome, Firefox and Edge so it does not seem to be browser specific. I have tried disabling A/V on affected computers as that seems to be the only mention of the issue on the web. Note also that we are able to to download Excel files that are on the web server (not streamed through the Aspose.Cells component) without issue.

Question - Is anyone else experiencing this issue and if so, have you been able to fix it?

@scottbutler,

If this was working fine for a few years for all the users and suddenly you are finding this issue for some users, that means your issue is not concerned to Aspose.Cells component. It might be due to the behavior of the browser type, proxy settings in your specified environment or else. We recommend you to kindly add Response.End() method to your code at the end if it makes any difference. For your information, Aspose.Cells uses Response object in the background while retrieving the Excel spreadsheet on the client side when you use Workbook.Save() overloads involving Response object as its parameter. The issue does not seems to be related to Aspose.Cells. For confirmation, please do not involve Aspose.Cells component/APIs while retrieving the file on the client side, you should get the similar issue. You may try to replace the line of code accordingly. Refer to the sample code below:
e.g.
Sample code:

…
/*Send workbook to response*/
var xSaveOptions = new XlsSaveOptions(SaveFormat.Excel97To2003);
MemoryStream tempStream = new MemoryStream();
workbook.Save(tempStream, xSaveOptions);
//You may change it accordingly if you are saving in XLSX file format
Response.ContentType = “application/vnd.ms-excel”;
Response.AppendHeader(“Content-Disposition”, “attachment; filename=out1.xls”);
Response.Flush();
Response.BinaryWrite(tempStream.ToArray());
Response.End();

Hi,

I have tried this method of saving as well as trying Response.End and HttpContext.Current.ApplicationInstance.CompleteRequest() which does not throw an exception like Reponse.End. I have also tried the save with and without Response.Clear before calling Save or saving to memory and streaming (like above). None of these items has any affect. Many users still get the Failed Network Error.

Any idea on ways to debug this would be appreciated. Thinking possibly trying wire shark or similar next.

@scottbutler,

You should compare configurations/settings and other environment details of your culprit (users) machines with good machines and sort it out by yourselves. This is not an issue with Aspose.Cells APIs by any means but if you still think Aspose.Cells APIs has this issue, kindly create a separate sample application (runnable) and mention possible steps with environment details to reproduce the issue on our end. Also give us complete error trace, we will check it soon.

PS. please zip the project prior attaching.

After a day of Googling, I finally found the answer. Putting it here in case someone else experiences the issue. This was not an issue with Aspose, it was with IIS. The issue was that we had http/2 turned on in IIS for HTTPS. It flat out does not work for file downloads for us. Fortunately, Windows Server 2019 put a flag that you can turn off http/2 off in the binding dialog (for https only). Once I turned this off, the downloads worked fine.

Here is the article that led me to the solution:

@scottbutler,
Thank you for the feedback and sharing this informative link that is helpful in resolving this issue. Please feel free to write us back if you have any other query related to Aspose.Cells.

Came here from Google for also having an issue downloading XLSX files generated by Aspose.

In my case, disabling HTTP/2 was also the solution.

This can be done through the GUI in more recent Windows Server editions:

https://help.goacoustic.com/hc/en-us/articles/360052067413-Disable-HTTP-2-in-IIS-10

Works also on a per-site-binding.

@Uwe_Keim,

Thanks for sharing the solution/workaround which might help some users.

1 Like