【问题标题】:Insufficient Memory Exception in WCF Large File UploadingWCF 大文件上传内存不足异常
【发布时间】:2015-08-10 07:15:52
【问题描述】:

我正在尝试使用 WCF 上传大文件 (>10GB)。 Service Web.config 如下

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding" maxBufferPoolSize="2147483647000000" maxReceivedMessageSize="2147483647000000" transferMode="Streamed">
      <readerQuotas maxDepth="200000000" maxStringContentLength="2147483647"
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>

<client>
  <endpoint address="http://localhost:42890/Service1.svc"  behaviorConfiguration="endpointBehavior"
    binding="basicHttpBinding" 
    contract="UploadFileService.IService1" name="BasicHttpBinding"  />
</client>

客户端web.config如下

   <bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding" closeTimeout="10:00:00" openTimeout="10:00:00"
      receiveTimeout="10:00:00" sendTimeout="10:00:00" maxBufferPoolSize="2147483647000000"
      maxReceivedMessageSize="2147483647000000" />
  </basicHttpBinding>
</bindings>

运行代码时出现内存不足异常,如何解决?

【问题讨论】:

标签: c# web-services visual-studio-2010 wcf memory


【解决方案1】:

在您的解决方案中,目标是 x64 而不是 Any CPU。这将允许更多的内存分配。

但是,根据您的解决方案,您也许可以将文件 Stream 到磁盘,而不需要使用太多内存。

【讨论】:

  • 我猜是web.config的问题,但我想不通。 @AndreAndersen
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-11-05
  • 1970-01-01
  • 1970-01-01
  • 2013-03-23
  • 2012-12-01
  • 1970-01-01
  • 2016-08-23
相关资源
最近更新 更多