简体   繁体   中英

POST request body causes 404 on IIS server

I have a React frontend and aspnet core backend. It seems like the post request body sometimes causes a 404 from IIS.

It works fine locally when I run the backend from VS.The symptom appears only in customers environment where the app runs on a IIS server.

The issue seems to be that the request body contains an array. All is fine if the array is empty.

Request body - no problem:
[
  {
    "foo": "bar",
    "zot": []
  }
]

Request body - gives 404
[
  {
    "foo": "bar",
    "baz": [
      "zot": 1
    ]
  }
]

There are reasons why there is no logging yet, which would help to find out if it is a real 404. For the same reason I don't have access or any information of the IIS-setup yet.

So my questions are: Is it possible that IIS can give 404 instead of 400 or 500? Can the POST request body cause a 404 error?

This is now solved. The real cause for the error was that my db schema differed from the one in test environment. So the real error was a "Microsoft.Data.SqlClient.SqlError". For some reason IIS responsed with a 404 instead of a 500.

As Lex Li pointed out, there are also sub codes for 404 errors. In this case it was 404.0. It would be great to know why IIS is behaving like this and if it is configurable somehow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM