Downloading files 500 error
See original GitHub issueHello,
case 1) When downloading files, only one connection can download the same file. The next connection will get a 500 error ( some exception occurred ).
case 2) If a client is downloading a file and the client connection is closed, the file remains open and the next connection gets the 500 error again.
I didn’t want to go through downloading the source code and compiling/testing again since you seem to be fixing and pulling fast and the error is obvious:
FileStream fs = new FileStream(filePath, FileMode.Open);
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = contentLength;
ctx.Response.ContentType = GetContentType(filePath);
await ctx.Response.Send(contentLength, fs);
return;
I assume all you have to do is fs.close()
to close the files stream although i have not tested this. It should at least be enough for case 2.
Issue Analytics
- State:
- Created 4 years ago
- Comments:25 (17 by maintainers)
Top Results From Across the Web
internal server error 500 and file not downloaded although ...
i design page download file file i need to download is create but can't download although i not get any exception error. error...
Read more >500 Internal Server Error when download file - Software Support
This means that the system cannot find or read the current file. Can you look at the path specify and check if the...
Read more >What is “HTTP 500 Internal Server Error” and How to Fix It?
A common cause of the “Internal Server Error” is a problem within the .htaccess file. If the file is corrupted, it defines an...
Read more >HTTP File Download 500 internal server error
When the server returns a 500 error, that means that an exception happened on the server. Unless you're using a non standards compliant ......
Read more >Error 500 (Server errror) when downloading ...
I have requested copies of my Google Drive via Google Takeout, and received the email to say that 6 files are ready to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Whew! I’m glad it is being caught properly now. Cheers @zaksnet thanks for all of your help.
Here it is!
Nuget: https://www.nuget.org/packages/Watson/3.0.7 Commit: https://github.com/jchristn/WatsonWebserver/commit/4d9993804591155b20c80039c7454125487a7f96
Here is the implementation of the
RequestorDisconnected
event callback (note all have return type of ‘void’ now):Please let me know if your situation is caught using the
RequestorDisconnected
event callback once you upgrade to 3.0.7!