2

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?

Bo Hu
  • 327
  • 1
  • 3
  • 13
  • 1
    Why not set it up as a one-way call from the client and then have the client periodically query the service to get a status. – Tim Mar 23 '16 at 23:44
  • @Tim, yes in client app, I use Task.Run() to implement a fire & forget API call, just when I test the WCF in Chrome's Postman, it gives a 504 error. I'like to ensure the process in WCF is still running after 504 is returned. – Bo Hu Mar 24 '16 at 02:04

1 Answers1

0

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.

Guvante
  • 18,775
  • 1
  • 33
  • 64
  • In client app, I use Task.Run() to implement a fire & forget API call, log the job status as running, and have ajax checking the completion every x seconds, just when I test the WCF in Chrome's Postman, it gives a 504 error. I'like to ensure the process in WCF is still running after 504 is returned to the client side – Bo Hu Mar 24 '16 at 02:04
  • You need to expose a way to check on a different endpoint whether completion is done or not. Holding the WCF connection open as you are will lead to these kinds of errors. If you were communicating in some way it could be made to work but just waiting tens of minutes will be difficult as that is a long time to have a connection open with no data transmitting. – Guvante Mar 24 '16 at 17:24
  • that is exactly what I am doing have different wcf checking status, my concern is the 1st task implementation wcf cannot hold connection for too long, how can I make sure it always run and complete? I don't mind a one-way call and forget the result, have the status wcf checking later on. – Bo Hu Mar 28 '16 at 22:27