Undocumented TypeError: Failed to fetch when uploading file on swagger (.net core 3.1)

1.8k Views Asked by At

I am facing this error when I am trying to upload excel file (length around 4 MB) on swagger api (.Net core 3.1). Its working on local as well as on other Azure app services (azure.net) but when I am trying to configure my code on azure virtual machine IIS, this error is coming on the domain api.

I tried lot of things adding headers, allowing CORS, increasing maxuploadlength, enabling SSL but nothing seems work. Mainly its occurring on application configured on a azure VM IIS server with SSL domain.

enter image description here

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Please check if any below points are the cause.

  1. This may happen with windows os version compatibility with the sdks .Try upgrading or downgrading visual studio. HTTP/2 is supported with ASP.NET Core in the following IIS deployment scenarios:

a) Windows Server 2016 or later / Windows 10 or later b) IIS 10 or later c) TLS 1.2 or later connection

  1. Update the Chrome browser to the latest version that’s compatible with your operating system, clearing cache and cookies , restart the laptop and start visual studio or the IDE again else Try uninstall any updates
  2. Please make sure SSL certificate is trusted and enabled TLS 1.2
  3. Please check if Web Application Firewall is enabled for your app . and check for file upload limit field is specified.It controls the maximum allowed file upload size and can have a minimum value of 1 MB. See Web application firewall request size limits
  4. See if Azure virtual machine is running the supported version of the operating system that is required .

References:

  1. JsonSerializerOptions.MaxDepth Property (System.Text.Json) | Microsoft Docs
  2. php - What's the net::ERR_HTTP2_PROTOCOL_ERROR about? - Stack Overflow