简体   繁体   English

长时间运行 WCF 504 GATEWAY_TIMEOUT 错误

[英]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).我正在 webHttpBinding 上开发 WCF web 服务,客户端应用程序按需调用此 WCF web 服务(HTTP POST)或通过调度程序 Windows 服务(当前使用 Quartz.net)。

Each call will run a list of tasks that can take 10-30 minutes.每次调用都会运行一个可能需要 10-30 分钟的任务列表。 I am getting 504 Gateway_Timeout error after 1 minute. 1 分钟后我收到 504 Gateway_Timeout 错误。 I've tried increase the limit in WCF webservice but still getting the error.我试过增加 WCF webservice 中的限制,但仍然出现错误。

<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?我不确定当 Web 请求超时时 WCF 是否仍在运行? 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.我已经尝试使用所有 switchvalue 跟踪日志并使用 traceviewer 来监视输出,没有发现错误。

My questions is should WCF service be designed as webHttpBinding service, or should I design it as a different type?我的问题是应该将 WCF 服务设计为 webHttpBinding 服务,还是应该将其设计为不同的类型?

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.这将确保没有任何超时,因为连接将是短暂的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM