2009-03-17 2 views
3

콘솔 앱에 SOAP 웹 서비스가 추가되었으며 특정 전화를 할 때마다 시간 초과가 발생했습니다. 다른 통화도 정상적으로 작동합니다. 콘솔 앱에서 타임 아웃 길이를 늘리려면 어떻게해야합니까? 현재 약 90 초 정도 인 것 같습니다.콘솔 앱 (.NET)에서 SOAP 요청 제한 시간

감사합니다.

답변

5

// 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); 
} 

}. 기본값은 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); 당신은 Timeout 속성을 설정하여 웹 서비스 클라이언트 시간 제한을 설정할 수 있습니다