0

I have a Asp.Net WebApi method (POST) that works in one IIS server but when deployed to another IIS server (both the servers are IIS 8), if the request body is kept empty I get a error returned as below :

Request Rejected. The requested URL was rejected. Please consult with your administrator.

If I put any character in the request body - I get the expected result ! Any idea what I can check ? I believe some settings in the server - as the service is working in to former server - its only the later server that doesn't accept an Empty Request Body !

Unsuccessful request enter image description here

Successful request/response when entered some garbage character in request body ! enter image description here

Update The response header for the unsuccessful response:

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Connection: close
Content-Length: 188
marifrahman
  • 681
  • 2
  • 13
  • 31
  • https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis Enable FRT and see what it says. – Lex Li Aug 11 '20 at 07:42
  • Could you view this request in IIS log? If it is not displayed in IIS, what's the value of response server header? Besides, have you tried to disable security software? It looks like an error returned from http.sys instead of IIS. – Jokies Ding Aug 12 '20 at 07:26
  • @Jokie Ding: IIS logs doesn't have these request. Response header is updated. Can you please be elaborate about the security software ? Antivirus or firewall you mean ? My IIS is running on Windows Server 2012 R2, anyway. – marifrahman Aug 12 '20 at 11:34
  • 1
    If the IIS logs don't have the request, it is possible that your request is not even reaching the server. googling your error message suggests that eg an F5 firewall might cause this. So: Do you really need to handle empty POST bodies? – Chris F Carroll Aug 12 '20 at 12:00
  • 2
    You should test that solution [https://stackoverflow.com/a/28353068/13664939](https://stackoverflow.com/a/28353068/136649399) – gurkan Aug 12 '20 at 13:43
  • @ChrisFCarroll : My Api doesn't have any requestbody - an work around could be putting some meanignless character in the request body instead of keeping it blank. – marifrahman Aug 12 '20 at 13:49
  • @marifrahman Did you post the full response body? Because it is lacking of server header Server: Microsoft-IIS/10.0 or Server: Microsoft-HTTPAPI/2.0. Could you see that failed request in C:\Windows\System32\LogFiles\HTTPERR\httperr.log? – Jokies Ding Aug 13 '20 at 09:12

0 Answers0