Search code examples
c#wcfquartz-schedulerwebhttpbindinghttp-status-code-504

Long time running WCF 504 GATEWAY_TIMEOUT error


I am developing a WCF web service on webHttpBinding, client application calls this WCF webservice on demand (HTTP POST) or via scheduler windows service ( currently using Quartz.net).

Each call will run a list of tasks that can take 10-30 minutes. I am getting 504 Gateway_Timeout error after 1 minute. I've tried increase the limit in WCF webservice but still getting the error.

<webHttpBinding>
    <binding name="webHttpBindingWithJsonP"  closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxReceivedMessageSize="50000000" maxBufferSize="50000000" maxBufferPoolSize="50000000" crossDomainScriptAccessEnabled="true"/>
  </webHttpBinding>


 <httpRuntime executionTimeout="1800" targetFramework="4.0"/>

Regardless of the error, task will always complete. I am not sure if WCF is still running when web request is timed out? If a task need less time, for example half minute then it returns valid result.

I've tried trace logs with all switchvalue and use traceviewer to monitor the output, no errors were found.

My questions is should WCF service be designed as webHttpBinding service, or should I design it as a different type?


Solution

  • Have you considered providing a status page as part of your initial call and then having the user check the status page (repeatedly) to verify if the task is complete?

    This will ensure that nothing times out as the connection will be short lived.