1

I have a handler that return a json, I some cases I execute more manipulations with data that increase execution time (10 min for example)

I want to increase timeout (to avoid 504 Gateway Timeout ) for this handler, I tried to add in web.config global executionTimeout

<system.web>
      <!-- Set timeout 10 minutes -->
      <httpRuntime executionTimeout="600"/>
 </system.web>

directly to my handler name

<location path="myHandler.ashx">
   <system.web>
      <httpRuntime executionTimeout="600"/>
   </system.web> 
</location>

Inside the handler in ProcessRequest

 context.Server.ScriptTimeout = 600000;

no one of above solutions not resolve 504 error code

WS 2012 R2, IIS 8.5 In postman Time-out is after 45020 - 45050 ms (~45 sec)

Alex
  • 8,908
  • 28
  • 103
  • 157
  • Wouldn't the gateway timeout come from a load-balancer (or reverse proxy, cache or other similar L7 device) between you and the server? – spender Mar 20 '18 at 13:50
  • @spender I don't have any load-balancers, everything by default, webapp in iis – Alex Mar 20 '18 at 13:54
  • Ok, but the message is clear: "504: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI" How, specifically is the app deployed? – spender Mar 20 '18 at 14:01
  • Timeouts are usually the idle time before a disconnect. If you are sending data then you should not have any idle time. You error is being cause by a different issue. I suspect you are sending http 1.1 which is chunk mode and you are not sending the next chunk message which is causing the error. Correct solution is to use http 1.0 which is stream mode that doesn't require the next chunk message. – jdweng Mar 20 '18 at 14:02
  • @jdweng HTTP 1.1 is "chunk mode"? Really? Fall back to HTTP 1.0? Really? – spender Mar 20 '18 at 14:05
  • @spender what exactly you want to know? – Alex Mar 20 '18 at 14:34
  • Yes, Yes,Yes. Use a sniffer to verify HTTP mode. There are a lot of posting with people getting timeouts with HTTP 1.1 with Net Library. Lot of fixes that do not work. So I just set the HTTP Version in the request to 1.0. – jdweng Mar 20 '18 at 15:11

0 Answers0