mscorlib.dll中发生了未处理的"System.ServiceModel.CommunicationException"类型异常

4 visual-studio-2010 mscorlib c#-4.0

我在Web服务中调用方法时遇到以下错误,而不是由我开发.

mscorlib.dll中发生了未处理的"System.ServiceModel.CommunicationException"类型异常

它不仅发生在我的本地开发机器上,而且发生在部署软件时也发生在客户端的服务器上.

我目前正在使用Visual Studio 2010.

小智 8

在捕获CommunicationException并查看InnerException之后,我发现了以下详细信息:已超出传入消息的最大邮件大小配额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.此问题的解决方案是将以下内容添加到我的配置文件中.

<bindings>
  <basicHttpBinding>
    <binding name="R2MSBulkUploadSoap" allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
    </binding>
  </basicHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)

我从这里找到了这个解决方案