2009-03-17 24 views

答えて

5

あなたはTimeoutプロパティを設定することで、Webサービスクライアントのタイムアウトを設定することができます。デフォルトは100000ミリ秒(100秒)です。例えば

MyWebServices.Webservice svc = new MyWebServices.Webservice(); 
// Set timeout to 200 seconds 
svc.Timeout = 200000; 
svc.DoWork(); 
0

これにより、タイムアウトを変更し、変更されたことを確認する必要があります。

public int Timeout {get;セット; }

[トランザクション(タイムアウト= 30)] パブリッククラスTransactionAttribute_Timeout:のServicedComponent {公共ボイドTimeoutExample(){ // TransactionAttributeクラスに適用されます。 TransactionAttribute属性= (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); 
} 

}

関連する問題