asp.net-core-3.1iis-10

ASP.NET Core IIS 10 File Upload silently failing


Well, after trying to figure this out for a number of days now I'm stumped. I have a ASP.NET Core 3.1 razor pages web application hosted in IIS 10 with a file upload feature that works in one environment and not another. Specifically, the DEV IIS site works as expected and the staging IIS site is failing very quickly with file sizes that should work.

So I know that it's not a code that's the issue since it's exactly the same code in both environments. There must be some IIS setting that I am not finding that is causing the issue.

The IIS settings are default web app settings so the IIS 10 file size limit should be 28.6 MB. Again, the DEV IIS app works but the Staging app fails whith a 4 MB file. Does anyone know of any settings that could be causing this issue?

If it helps the error I get in the browser console is net::ERR_CONNECTION_CLOSED. I've added a screen shot of the file upload failing a few seconds after it starts, it always fails at the same point, as well as the error message in the browser console.

Failed upload

Error

UPDATE: I'm starting to think this might not be IIS and something else is going on. The upload works with very small files. Although a file that is 512.62 KB is failing at 34% uploaded. This is a Telerik MVC Upload component being used that tells me the percentage. So I count vouch for how accurate it is

File sizes I've tried.

Failed at 54%: 325.56 KB

Failed at 85%: 205.32 KB

Failed at 0%: 105.54 KB


Solution

  • I want to answer my own question here so that anyone else who runs into a similar problem can use this to help solve it. In my case the answer to the problem turned out to be that the Telerik AspNetCore Upload component doesn't provide it's own AntiForgery token. This unfortunately fails silently and it took a long time to figure it out.