Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My web api gives net:: ERR_CONNECTION_RESET error only from ajax client

My web api was working in several IISs and when moved to Azure VM, it gives net:: ERR_CONNECTION_RESET when calling only from ajax client but works proper when using POSTMAN.

When hitting from ajax html client it says net:: ERR_CONNECTION_RESET in OPTIONS request. Thought that it didnt reach the server but when referring http error file in

C:\Windows\System32\LogFiles\HTTPERR

It shows

2017-07-20 12:54:06 210.18.173.26 54141 10.0.1.4 80 HTTP/1.1 OPTIONS /api/User/Method1 - 1 Request_Cancelled myappapipool

In web.config

 <add name="Access-Control-Allow-Origin" value="*" />
 <add name="Access-Control-Allow-Headers" value="Content-Type" />
 <add name="Access-Control-Allow-Credentials" value="true" />
 <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS" />

I have tried adding timeout in web.config, it is not solving. Also tried changing the web config "Access-Control-Allow-Headers" value to "*", it gave preflight request error.

Since the same server and ajax client communication is working in other iis, i suspect there is something fishy which i missing while configuring my web api in IIS which is located in Azure VM. When calling from POSTMAN or android client it is working like a charm with the existing configuration in IIS.

Any help/suggestion is much appreciated.

like image 203
timblistic Avatar asked Jul 20 '17 14:07

timblistic


People also ask

What is Net :: Err_connection_reset?

If you're receiving the ERR_CONNECTION_RESET error message, it means that your internet browser is unable to connect to the target website's server.


1 Answers

Request_Cancelled Coming in HTTPErr log is caused by the DynamicIPRestrictions Module mitigating against DDOS attacks.

if you setup Dynamic IP Restrictions with "Deny Action Type" set to "Abort Request", the requests will be aborted and logged as "Request_Cancelled" in the HTTPErr log

By default Dynamic IP Address Restrictions may abort the request if more than 5 concurrent requests come(check what is the configured setting in your server.) And that may be reason why it works for one server and does not work in Azure environment.More details can be found on Security guidelines to detect and prevent DOS attacks targeting IIS/Azure Web Role (PAAS)

like image 169
Rohith Avatar answered Oct 08 '22 10:10

Rohith