0

I'm getting a network error when trying to download an Excel file from my web application hosted on a remote server. The request returns 200 OK response in network tab and file downloads until 64kb (total 274kb), then it stops.

The site turns to service unavailable. I have log and trace in controller action but there was no errors. The Excel file downloads perfectly fine when I run the application locally.

I tried these solutions, but none of them work. If someone has any ideas please let me know.

  1. In web.config file, we added maxAllowedContentLength and responseBufferLimit
  2. I checked CPU, memory usage they are fine on server during download.
  3. I disabled HTTP/2 on binding
  4. I checked the MIME Type on IIS manager its showing correctly for .xlsx as application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  5. I checked Idle Timeout and recycle on application pool. They are fine.

1 Answer 1

0

I suggest you could firstly modify the web.config to modify the request filtering in IIS.

  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="524288000" /> <!-- 500MB -->
    </requestFiltering>
  </security>

Besides, I suggest you could modify the request limit inside the program.cs, like below:

builder.WebHost.ConfigureKestrel(serverOptions =>
{
    serverOptions.Limits.MaxRequestBodySize = 100_000_000;
});
Sign up to request clarification or add additional context in comments.

2 Comments

I tried both in web.config file and adding MaxRequestBodySize in program.cs. The issue still remains. The download stops at 64kb and become service unavailable.
I suggest you could try to enable the fail request tracing from this articleto see which module cut the connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.