Change timeout for each WCF method or call

前端 未结 1 1728
攒了一身酷
攒了一身酷 2021-01-05 12:40

I have a quite large \"old\" WCF Service with many different methods.

The most of these methods are \"normal\" so they should answer in less than 10 seconds but ther

1条回答
  •  执念已碎
    2021-01-05 13:27

    First of all, the timeout to configure in your case is OperationTimeout, which allows the time limit to wait for the service to reply before timing out. You can modify the operation timeout before making a call from the client side.

    To set the OperationTimeout on the channel, you can type case your proxy/channel instance as IContextChannel and set OperationTimeout.

    For example:

    IClientChannel contextChannel = channel as IClientChannel;
    contextChannel.OperationTimeout = TimeSpan.FromMinutes(10);
    

    HTH, Amit

    0 讨论(0)
提交回复
热议问题