由于一台服务器而非另一台服务器上的堆栈溢出错误,该进程被终止

发布于 2024-12-22 10:04:36 字数 2254 浏览 0 评论 0原文

当我们的 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 将其清除。我不认为这会导致堆栈溢出问题。

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

有什么想法吗?

干杯

we are getting the above error when our web service is called on a particular server but not on another. Here is the code that is used....

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

No i have just thought that i may not be calling EndInvoke on results that are not completed. So i presume .NET would store this in memory until the GC would clear it up. I don't think this would cause a stack overflow issue though.

We also get the issue even if just one asynchronous call is made. I'm not a massive server expert either, but the server it is working on is a lot worse than the one it isn't working on.

Any ideas??

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文