尚未启动时WCF服务超时

时间:2009-12-21 16:59:02

标签: wcf wcf-client performance

我有自助托管的WCF服务。当InstanceContextMode设置为PerCall时,除了缓慢之外它工作得很好。 (构造函数非常重,所以非常有意义)我将InstanceContextMode设置为Single,现在它在服务启动后工作正常。但是,如果该服务仍在启动,我将收到有关未找到终点的错误。当我在PerCall模式下运行时,这不会发生。 有什么办法可以让请求等待更长时间才能启动服务吗?我已尝试在绑定上设置OpenTimeout,ReceiveTimeout和SendTimeout,但无济于事。

这是我的主叫代码:

try
{
    ChannelFactory<IGatewayService> scf;
    var binding = new NetTcpBinding();
    binding.Security.Mode = SecurityMode.None;
    scf = new ChannelFactory<IGatewayService>(binding, "net.tcp://" + settings.GatewayHost + ":" + settings.GatewayPort);
    IGatewayService s;
    s = scf.CreateChannel();
    result = s.Submit(taskToSubmit);
    (s as ICommunicationObject).Close();
}
catch (Exception exc)
{
    if (log.IsErrorEnabled) { log.Error("Error submitting task to Gateway", exc); }
}

PS。我是一个WCF-noob,但我相信你们现在都已经知道了这一点;)

0 个答案:

没有答案
相关问题