[转]Webservice client timeout

本文转自:http://social.msdn.microsoft.com/Forums/vstudio/en-us/ed89ae3c-e5f8-401b-bcc7-333579a9f0fe/webservice-client-timeout?forum=wcf

After creating proxy object do this :

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

 

 

--------------------------------------------

 

Please find the code below:

            
            ReportPortClient client = new ReportPortClient("Report");
            client.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 6, 0);
            client.Endpoint.Binding.CloseTimeout = new TimeSpan(0, 6, 0);
            client.Endpoint.Binding.SendTimeout = new TimeSpan(0, 6, 0);
            client.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 6, 0);

            client.ClientCredentials.UserName.UserName =strUserName;
            client.ClientCredentials.UserName.Password = strPassword;
            client.Endpoint.Address = new System.ServiceModel.EndpointAddress(strURL);

 

原文地址:https://www.cnblogs.com/freeliver54/p/3566157.html