【问题标题】:System.OutOfMemoryException on multiple asynchronous calls to a WCF serviceSystem.OutOfMemoryException 对 WCF 服务的多个异步调用
【发布时间】:2016-07-29 17:09:29
【问题描述】:

我有一个 Windows 服务同时对 WCF 服务执行多个异步调用(使用 Parallel.Foreach 循环)。

WCF 服务正在生成多个 System.OutOfMemory 异常。

是否需要配置一些东西才能使多线程成功运行?我的理解是 IIS 管理线程资源。我相信我的理解是不正确的。

如有任何帮助,我们将不胜感激。

【问题讨论】:

  • 每次调用服务都在做什么工作?
  • 少打电话。我怎么不认为你可以做任何其他事情。如果内存不足只是一个调用引起的怎么办?
  • 一次通话是否完成?你的 WCF 做什么?有代码吗?
  • 同时显示服务器代码。
  • 您的代码中存在导致内存使用过多的缺陷。许多并行调用通过边缘发送资源使用情况。如果没有看到有缺陷的代码,就无法回答这个问题。暂时关闭。

标签: c# multithreading wcf asynchronous


【解决方案1】:

将其添加到您的 web.config:

<bindings>
  <basicHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 2012-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-21
    相关资源
    最近更新 更多