我们收到此错误:
System.ServiceModel.ServerTooBusyException:创建可靠会话的请求已被 RM 目标拒绝。服务器“net.tcp://localhost:50000/”太忙,无法处理此请求。稍后再试。无法打开通道。
据我了解,我需要在 ReliableSession 绑定中增加 MaxPendingChannels 的值。
但是我们在这样的代码中配置 WCF:
serviceHost = new ServiceHost(typeof(MyServiceClass));
ServiceEndpoint endPoint = serviceHost.AddServiceEndpoint(
typeof(IMyService),
new NetTcpBinding(SecurityMode.None, true),
endPointAddress);
那么如何以编程方式设置 ReliableSession.MaxPendingChannels 呢?(我能找到的所有示例都使用配置文件)
在此网页上搜索 MaxPendingChannels 以获得一个选项,但它似乎过于复杂。