コンソールアプリ(.NET)でのSOAP要求のタイムアウト
-
19-08-2019 - |
質問
コンソールアプリに追加されたSOAP Webサービスがあり、特定の呼び出しを行うたびにタイムアウトが発生します。その他の呼び出しは正常に機能します。コンソールアプリでタイムアウトの長さを増やすにはどうすればよいですか?現在は約90秒のようです。
ありがとう。
解決
タイムアウトプロパティ。デフォルトは100000ミリ秒(100秒)です。
例:
MyWebServices.Webservice svc = new MyWebServices.Webservice();
// Set timeout to 200 seconds
svc.Timeout = 200000;
svc.DoWork();
他のヒント
これにより、タイムアウトを変更し、変更されたことを確認できます。
public int Timeout {get;セット; }
[トランザクション(タイムアウト= 30)] パブリッククラスTransactionAttribute_Timeout:ServicedComponent { public void 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);
}
}
所属していません StackOverflow