My application( asp.net core 6) is deployed in a private cloud and works very well under IIS until now the cloud service has banned all PUT and DELETE requests. I have to convert them. I will convert PUT to POST on the client side and customize CUSTOM_METHOD:PUT so that it can pass through the cloud service gateway, I wanted to get to the server and use the IIS Rewrite to change HTTP_METHOD to PUT so I wouldn't have to change the code, but I found it didn't work very well. I log that IIS Rewrite has changed HTTP_METHOD to PUT, but my asp.net core 6 is still receiving POST, which my restful API can't handle.
Instead of trying to change HTTP_METHOD
(which you cannot unfortunately), you have to modify your code to use what Microsoft recommended, the header of X-HTTP-Method-Override
.
It was initially documented in details in ASP.NET 4.x, and later echoed in ASP.NET Core as a less documented middleware.