I have a windows service where I'm invoking a Wcf Client endpoint like this.
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...");
I want to increase the timeout programmatically of the call to 10 mins for debugging purposes. How can I set the timeout property on the client like I normally would do in the bindings section in the app.config file like so
<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>
Cheers
You can set properties directly on binding:
var timeout = new TimeSpan(0, 0, 10, 0);
var binding = new NetTcpBinding(SecurityMode.None)
{
CloseTimeout = timeout,
ReceiveTimeout = timeout,
SendTimeout = timeout,
OpenTimeout = timeout
};
then:
.BoundTo(binding)