IIS slow file upload

djangoiis

I have an interesting problem – I have my own IIS 2016 server, that I use to host a website which allows the users to upload a variety of files – some in text format, the others zip'ed up together. Initially the website would return error 500 from the server when trying to upload something bigger, like ~50MB. I Googled up that IIS requires configuration of maxAllowedContentLength (changed default to 209715200, ~300MB) and FastCGI's parameters for IDLE, ACTIVITY and REQUEST (changed to 600) in order to allow bigger files upload without hitting the file size limit. However, now that the files are getting uploaded, the upload speed for these bigger files slowed down to a crawl. Previously I could upload ~11MB files in 8sec on a local network, while now 50MB takes like ~2.8min. Not a linear increase I would expect.

When I inspect task Manager on IIS while upload is on-going, I can see in Performance->Ethernet tab that for smaller files (e.g. 11MB) "receive" value keeps high at like 24Mbps, but when I try to upload a big file, this value drops down from an initially high value to like 2-4 Mbps. It feels almost as if IIS was throttling upload speed.

My website runs on Django, and my POST method file transfer is carried out by Ajax call in JS.

Can anyone give me any ideas about some IIS features I need to adjust in order to fix this?

Best Answer

Had the same problem and stumbled across this. Apparently wfastcgi.py is to blame. The file was apparently only updated on Github but not on pypi. https://github.com/Microsoft/PTVS/issues/2471

After updating the file in my site packages, it works for me at normal speed.

Here you can find the current file: https://github.com/Microsoft/PTVS/blob/master/Python/Product/WFastCgi/wfastcgi.py

Related Topic