我的 WCF 服务有问题。在程序完美运行三个小时后,我得到了以下异常。
System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:59.9843998. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout
我不认为增加超时将是一个解决方案。我认为只是几分钟后会抛出异常。也许我必须更改侦听器服务器上的任何设置。难道是我的机器在一段时间后关闭了端口?我这样称呼我的服务:
IServices service = null;
service = ChannelFactory<IServices>.CreateChannel(
new BasicHttpBinding(),
new EndpointAddress(
port));
result = service.addAppointments(appList);
我的听众:
ServiceHost host = new ServiceHost(service);
host.AddServiceEndpoint(typeof(
IServices),
new BasicHttpBinding(), port);
host.Open();
就这样。到目前为止,无需进一步设置。