【发布时间】:2019-10-26 17:04:03
【问题描述】:
我有一个 WCF 服务的问题,该服务托管在 Azure 中运行 IIS 10 的 Windows 2016 VM 上。
该服务基本上是一个测试服务,我在 operationContract 中放入了一个 Thread.Sleep(计时器),并且持续时间作为 operationContract 中定义的参数发送。
问题是指定最长 4.2 秒的睡眠持续时间运行没有问题,但如果我调用指定 5 秒运行的服务。任务过程在 5 秒后结束,使用上面的代码,内部记录器通知我我已完成但由于某种原因 WCFTestClient 仍在等待响应并继续等待,直到达到配置的超时。在这种情况下,我在服务配置和客户端配置中都有我的 Receive_timeout 和 Send 10 分钟。
作为证据,我在我的网络中创建了一个本地环境,将服务安装在服务器上,在这里经过 5 分钟甚至 9 分钟的测试,测试客户端的行为符合预期。
[OperationContract]
public void TestServiceTimeout (int timer)
{
try
{
log.Info("Start test Service");
System.Threading.Thread.Sleep(timer);
log.Info("End test srervices");
}
catch (Exception ex)
{
log.Error($"An error ocurred. Details: {ex.Message}");
throw;
}
}
Web.Config IIS
<binding name="Control.ws.sTest.customBinding0" receiveTimeout="00:20:00"
sendTimeout="00:20:00">
<binaryMessageEncoding />
<httpTransport />
</binding>
WCFTestClient 配置
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_sFacturacion" sendTimeout="00:10:00" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:60000/ws/sFacturacion.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_sFacturacion"
contract="sFacturacion" name="BasicHttpBinding_sFacturacion" />
</client>
【问题讨论】:
-
如果您在托管 WCF 服务的 VM 上运行 WCFTestClient,您能否重现此问题?
标签: azure wcf virtual-machine