2012-11-14 58 views
0

使用.NET 1.1的此Web服務的生產版本不存在此問題。這是在Windows Server上運行.NET 4.0 2003爲什麼Web服務方法的調用幾乎立即超時?

我有哪裏我收到下列異常問題的測試環境:

System.Net.WebException: The operation has timed out  
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)  
at System.Net.HttpWebRequest.GetRequestStream()  
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)  
at HTP.RHIO.PIRManager.TargetWS.PIRService.Upload(Transmission t_request)  
at HTP.RHIO.PIRManager.Manager.PIRManager.Upload(Transmission request) 

這發生在我的web服務的上傳方法調用另一個Web服務的上傳方法。超時幾乎立即發生,大約1/3秒(注意log_datetime列)

Log

代碼:(它登錄異常輸出的間隔線還沒有實現,這就是爲什麼它。沒有出現在輸出應該通過爲默認值下降區間= 60 * 1000])

int interval = 0;                   
try 
{ 

    try 
    { 
     interval = Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["RealTimeTimeOutSeconds"]); 
    } 
    catch(Exception ex) 
    { 
     interval = 60; 
    } 

    interval = interval * 1000; 
    target.Timeout = interval; 
    trans = target.Upload(trans); 
    }        
    catch(System.Net.WebException ex) 
    {    
     request.TransmissionHeader.MessageCode = GetReturnMessageCode(ex); 
     request.TransmissionHeader.Message = ex.Message; 
     Log(request.TransmissionHeader, "Upload", "FAILED", "(Timeout = " + interval.ToString() + ") " + ex.ToString(), 1); 

     trans = TA1forFailedRealtimeUpload(trans.TransmissionHeader);          
     request = ConvertToLocal(trans, request); 
     Log(request.TransmissionHeader, "Upload", "SENDING", "Responding to sender with TA1", 1); 
     return request;        
    } 
} 

,並從我的web服務的web.config文件:

<httpRuntime executionTimeout="600" maxRequestLength="2000000"/> 

回答

0

Convert.ToInt16可能不會完全符合您的期望。從the manual;

返回值

類型:System.Int16
一個16位有符號整數,它等效於在值的數目,或0(零),如果值爲空。

如果RealTimeTimeOutSeconds沒有在您的配置中設置,您將轉換NULL,這將導致零超時。

相關問題