I recently ran into some issue when attempting to transmit large files as a response to an ASP.NET request. My App was set up with the following standard code:
Response.AddHeader("Content-Length", info.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + info.Name);
Response.WriteFile(path);
It turns out that WriteFile causes the server to attempt to buffer the response, and with a large file this just makes the server sit and time out with no useful error message being returned. I first got thrown off and attempted to increase buffer limits in IIS (defaulted to 4MB), but that did not help the issue. I then found Response.TransmitFile which does not buffer the response. So far, Response.TransmitFile appears to have fixed the issue. The files in question were 75MB to 100MB a piece. I had tested and 20MB files were able to make it through with the original code (odd with IIS's default limit being 4MB). So, I am not certain where the cutoff is, and what, if any, setting would allow Response.WriteFile to function for larger files.
Another odd part about this error was that when running locally in debug mode in VS, I had no problems. The file was still located on a network server. However, when the application was run from the server the error occurred.