由于一个服务器上的堆栈溢出错误而不是另一个服

时间:2011-12-23 10:14:02

标签: .net asynchronous stack-overflow

当我们在特定服务器上调用我们的Web服务而在另一台服务器上调用时,我们遇到上述错误。这是使用的代码....

foreach (Service service in serviceSetup.Services)
{
    if (service.CallService == true)
    {
        serviceConfig = ServiceConfigurationFactory.CreateConfiguration(service.Name, service.URL);
        aSyncRequest = new ASyncRequest(serviceConfig.GetEnrichmentXML);
        IAsyncResult res = aSyncRequest.BeginInvoke(request, null, null);
        results.Add(res);
        waitHandles.Add(res.AsyncWaitHandle);
    }
}

bool terminExists = false; 
if (waitHandles.Count > 0)
{
    WaitHandle.WaitAll(waitHandles.ToArray(), Convert.ToInt32(Utils.AppSetting("ServiceWaitTime")));

    foreach (IAsyncResult res in results)
    {
        if (res.IsCompleted)
        {
            try
            {
                returnEnrichmentXML = aSyncRequest.EndInvoke(res);
                if (!string.IsNullOrEmpty(returnEnrichmentXML.ABIQ))
                {
                    //need to see if we insert or concat the return enriched data as skinny can be done locally in electRa
                    //prior to QuotesHub 
                    int index = enrichmentXML.ABIQ.IndexOf("99TERMIN|");
                    if (index > -1)
                    {
                        enrichmentXML.ABIQ = enrichmentXML.ABIQ.Insert(index, returnEnrichmentXML.ABIQ);
                        terminExists = true;
                    }
                    else
                    {
                        enrichmentXML.ABIQ = string.Concat(enrichmentXML.ABIQ, returnEnrichmentXML.ABIQ);
                        enrichmentABIQAdded = true;
                    }
                }
                if (!string.IsNullOrEmpty(returnEnrichmentXML.FullResults))
                {
                    enrichmentXML.FullResults = string.Concat(enrichmentXML.FullResults, returnEnrichmentXML.FullResults);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex);
                throw ex;
            }
        }
    }
}

不,我只是想到我可能没有在未完成的结果上调用EndInvoke。因此,我认为.NET会将其存储在内存中,直到GC清除它为止。我不认为这会导致堆栈溢出问题。

即使只进行了一次异步调用,我们也会遇到问题。我也不是一个庞大的服务器专家,但它正在处理的服务器比它没有工作的服务器差很多。

任何想法??

干杯

0 个答案:

没有答案