Im using a web service for getting some result in long array as below:
try
{
System.Threading.ThreadPool.QueueUserWorkItem((o) =>
{
byte[] result = (new MagfaGetMessages()).getMessages(false,SMSUseProxy,SMSProxyAddress,SMSProxyUserName,SMSProxyPassword,1000);
});
}
}
catch
{
SMSwebServiceFailed = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:ff");
}
// GetMessage Class
public MAGFAWebService.DatedCustomerReturnIncomingFormat[] getMessages(Boolean useProxy, String proxyAddress, String proxyUsername, String proxyPassword, String username, String password, String domain, int numberOfMessages)
{
lock (MagfaLock)
{
MAGFAWebService.SoapSmsQueuableImplementationService sq = new MAGFAWebService.SoapSmsQueuableImplementationService();
if (useProxy)
{
WebProxy proxy;
proxy = new WebProxy(proxyAddress);
proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword);
sq.Proxy = proxy;
}
sq.Credentials = new System.Net.NetworkCredential(username, password);
sq.PreAuthenticate = true;
return (MAGFAWebService.DatedCustomerReturnIncomingFormat[])sq.getMessages(domain, numberOfMessages);
}
}
but some times I get this error :
The request failed with HTTP status 504: Gateway Time-out.
I used try{} catch as I shown in my code, I want to know why I got error and why it dosent catch?
the error will occure in this line :
MAGFAWebService.DatedCustomerReturnIncomingFormat[])sq.getMessages(domain, numberOfMessages
thanks for any helping.