我正在 webHttpBinding 上开发 WCF Web 服务,客户端应用程序按需调用此 WCF Web 服务(HTTP POST)或通过调度程序 Windows 服务(当前使用 Quartz.net)。
每次调用都会运行一个可能需要 10-30 分钟的任务列表。1 分钟后我收到 504 Gateway_Timeout 错误。我尝试增加 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"/>
无论错误如何,任务将始终完成。我不确定 Web 请求超时时 WCF 是否仍在运行?如果一个任务需要更少的时间,例如半分钟,那么它会返回有效的结果。
我已经尝试使用所有 switchvalue 跟踪日志并使用 traceviewer 监视输出,没有发现错误。
我的问题是应该将 WCF 服务设计为 webHttpBinding 服务,还是应该将其设计为不同的类型?