3

I have a SOAP web service added to a console app and every time I make a specific call its timing out on me. Other calls work fine. How do I increase the timeout length in a console app? Seems like it's currently about 90 seconds.

Thanks.

Wes P
  • 9,622
  • 14
  • 41
  • 48

2 Answers2

5

You can set the web service client timeout by setting the Timeout property. The default is 100000 milliseconds (100 seconds).

For example:

MyWebServices.Webservice svc = new MyWebServices.Webservice();
// Set timeout to 200 seconds
svc.Timeout = 200000;
svc.DoWork();
Kev
  • 118,037
  • 53
  • 300
  • 385
0

This should allow you to change the timeout and then verify that it has been changed.

public int Timeout { get; set; }

[Transaction(Timeout=30)]
public class TransactionAttribute_Timeout : ServicedComponent
{
    public void TimeoutExample()
    {
        // Get the TransactionAttribute applied to the class.
        TransactionAttribute attribute =
            (TransactionAttribute)Attribute.GetCustomAttribute(
            this.GetType(),
            typeof(TransactionAttribute),
            false);

        // Display the current value of the attribute's Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}",
            attribute.Timeout);

        // Set the Timeout property value of the attribute to sixty
        // seconds.
        attribute.Timeout = 60;

        // Display the new value of the attribute's Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}",
            attribute.Timeout);
    }
}
Metro Smurf
  • 37,266
  • 20
  • 108
  • 140
Shaun Humphries
  • 1,070
  • 9
  • 15