I have an issue on ASP.NET application which have been recently migrated to new server running IIS7 instead of IIS6. The application has been upgraded to .NET4 though most of the code remains as it was originally written in .NET 1.1. The application manages company's static tables and user can download any static table data in CSV or XML from a web page.
Issue - In case IIS7 feature 'Enable dynamic content compression' is turned on, the file is corrupted (the end of the file is trimmed). The corruption seems NOT to be random, i.e. I get always the same result as long as input data are equal. For different input data sets, the size of the effect (number of characters trimmed) are also different. When I switch dynamic compression off, the problem completely disappears.
Examples of downloads (i am posting always only the last line of the whole CSV file):
static table A
dynamic compresion off (complete file length 720 bytes):
2010-10-21 00:00:00;;"P ";"registrované partnerství";"REGISTERED PARNTERSHIP";"registrované partnerstvo";0
- dynamic compresion off (last 1 byte trimmed - i.e. last line-break lost its "LF" char), file length = 719 bytes):
static table B
dynamic compression off (no corruption, file length = 593349 bytes):
2012-04-16 00:00:00;;"800650";"Finanční centrum Třebíč";"PSB FC Třebíč";"PSB FC Třebíč";"PSB FC Třebíč";9;2;61;"67401";"Třebíč";"Karlovo náměstí 32/26";5057;2518;852;;;2012-05-02 00:00:00;0
- dynamic compression on (last 2 bytes trimmed (i.e. last CRLF is lost), file length = 593347 bytes):
static table C
dynamic compression off (no corruption, file length = 282 bytes):
2012-04-16 00:00:00;;"3";"Zaslat do vlastních rukou";0
dynamic compression on (last 5 characters trimmed, file length = 275 bytes):
2012-04-16 00:00:00;;"3";"Zaslat do vlastních ruk
static table D
dynamic compression off (no corruption, file length = 6506 bytes):
2010-02-20 00:00:00;2010-03-20 00:00:00;390;"879001";2;0
dynamic compression on (last 13 characters trimmed, file length = 6491 bytes):
2010-02-20 00:00:00;2010-03-20 00:00:00;390
The same happens for XML output format - but in such case the effect is always the same - XML is always trimmed by 1 character. Consequence is the end tag of the root element is not closed:
</Export>
versus
</Export
As a workaround I recommended to turn off dynamic compression. But I would like to understand what causes this behaviour. I have searched for solutions to the same issue on the web, but I have found only this issue, which is probably not relevant, since the input data are pure uncompressed CSV or XML: