【发布时间】:2017-11-28 09:49:22
【问题描述】:
我有一个 Windows 服务,我正在像这样调用 Wcf 客户端端点。
Console.WriteLine("Invoking start...");
using (var container = new WindsorContainer())
{
container.AddFacility<WcfFacility>();
container.Register(
Component.For<IShoppingService>()
.AsWcfClient(new DefaultClientModel(
WcfEndpoint
.ForContract<IShoppingService>()
.BoundTo(new NetTcpBinding(SecurityMode.None))
.At("net.tcp://localhost:12123/shoppingService"))));
container.Resolve<IShoppingService>().Debug();
}
Console.WriteLine("Invoking end...");
出于调试目的,我想以编程方式将调用的超时时间增加到 10 分钟。如何像通常在 app.config 文件的绑定部分中那样在客户端上设置超时属性,就像这样
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="longTimeOutLargeTcpBuffer" maxBufferSize="20000000" maxReceivedMessageSize="20000000" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00">
<readerQuotas maxArrayLength="20000000" maxBytesPerRead="20000000" maxStringContentLength="10000000" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
干杯
【问题讨论】:
标签: c# .net wcf castle-windsor wcf-binding