c# - Weird file download behavior in ASP.NET MVC application -


I have an action method in my MVC app that was saved on a file FileResult A basic problem in the database is that for some file types, the file can be returned by requesting a file, even if I have verified that the code in the content column is encoded The right material is made.

However, the really strange part is that how difficult it is for me, the reason for this is that the reason for this is. Here are some groups I can not understand:

  • Downloading text files, such as *. Txt and *. Csv gives an empty file, eg a PDF works properly to download

  • It is only on our CI server, and I It can not be reproduced on your local workstation.

  • CI server runs IIS7, while I perform locally on IIS Express which runs with Visual Studio

How do I bother this? What could be the cause of this?

OK, as the question is written is expected, this problem was very specific, For me, the actual fix for me is probably not interesting though, (hopefully) stumbled upon similar problems for someone else and for finding his way here (welcome!), I posted a summary of the problem solving campaign I will endeavor to help me find and fix the root cause. Lee. / P>

tl; Dr: The problem was the custom HTTP compression in this case - when it was shut down, everything was done.

Troubleshooting such problems - The signal has helped me solve this fast:

  1. Are you sure Are that your local settings reflect the production / staging environments? Not only that, they are to , but they do actually - if you are having problems recalling the error , Then it is almost certainly

    some things that may vary:

    • Create configuration: debug / release < / Code> / Other config setting in build script? In the IDE?
    • Web.config : We have a local Web.config file that is used by devs but produces the production version in our build The script based on a template Web.config.erb Do all the versions match?
    • IIS Settings: Do you have some custom settings on the production / staging server in IIS that are non- text / html data (or is it unsuccessful)? Do you use the same settings locally?
      & nbsp;

    Still got nothing? Okay, there are other ways to manually see the differences.

  2. Try to step on behalf of the CI build process, and publish your local version of the app. Hopefully, it can reveal some discrepancies that you remember.

  3. If you still do not find different settings, and still can not reproduce it locally, can you debug on the server? If you do not have VS installed on the server, then maybe try one (I did not manage to work it before seeing the problem, mainly because it was very slow on our setup, but it is worth trying. ..)


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -