WCF服务尚未启动时超时
我有一个WCF服务,我是自我托管。当InstanceContextMode设置为PerCall时,除了速度慢之外,它工作正常。(构造器相当重,因此非常有意义)我将InstanceContextMode设置为Single,现在它在服务启动后工作正常。但是,如果服务仍在启动,我会收到关于找不到端点的错误。当我在PerCall模式下运行时,这并没有发生。 有没有办法让请求等待更长的时间以启动服务?我已经尝试在绑定上设置OpenTimeout、ReceiveTimeout和SendTimeout,但没有效果 这是我的电话号码:WCF服务尚未启动时超时,wcf,wcf-client,performance,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); }
}
试试看
{
渠道工厂scf;
var binding=新的NetTcpBinding();
binding.Security.Mode=SecurityMode.None;
scf=新的ChannelFactory(绑定,“net.tcp://”+settings.GatewayHost+”:“+settings.GatewayPort);
iGateways服务;
s=scf.CreateChannel();
结果=s.Submit(任务提交);
(作为ICommunicationObject)。关闭();
}
捕获(异常exc)
{
if(log.IsErrorEnabled){log.Error(“将任务提交到网关时出错”,exc);}
}
顺便说一句,我是WCF的noob,但我相信你们现在都明白了;)