如何在Silverlight 2.0中延长Web服务的超时?

时间:2022-09-18 20:35:54

I am reading from a .NET 2.0 web service using Silverlight 2.0. The web service requests time out after 30 seconds, which is OK for most queries but occasionally I get a timeout. How do I extend the timeout to one minute?

我正在使用Silverlight 2.0从.NET 2.0 Web服务中读取。 Web服务在30秒后请求超时,这对于大多数查询都是可以的,但偶尔会出现超时。如何将超时延长到一分钟?

I tried this but it makes no difference.

我试过这个,但没有区别。

    SilverSearchSoapClient client = new SilverSearchSoapClient();
    client.Endpoint.Address = new EndpointAddress(App.ServiceEndpointUrl);
    client.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 1, 0);
    client.Endpoint.Binding.SendTimeout = new TimeSpan(0, 1, 0);
    client.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 1, 0);
    return client;

1 个解决方案

#1


 client.InnerChannel.OperationTimeout = new TimeSpan(0, 1, 0);

#1


 client.InnerChannel.OperationTimeout = new TimeSpan(0, 1, 0);