I have an action method in my MVC app which returns a FileResult
based on a file saved as a blob in the database. The root problem is that for some file types, requesting the file returns an empty file, even though I've verified that the database has the correct contents encoded in the Content
column.
However, the really odd part is how difficult it is to me to pin down exactly what's causing this. Here's a few gotchas that I can't make sense of:
Downloading text files, like
*.txt
and*.csv
returns an empty file, while downloading e.g. a PDF works correctlyThis only happens on our CI server, and I can't reproduce it on my local workstation. These are the only differences I can think of:
- I've verified that a commit that works on my machine, doesn't work on the CI server
- I've tried connecting the local workstation to the CI server's database engine, and was not able to reproduce. In other words, the problem is in the code, rather than in the database (but as pointed out, the same code that works locally doesn't work on the CI server...).
- The CI server runs IIS7, while I test locally on IIS Express that ships with Visual Studio
How do I trouble-shoot this? What could cause it?