C# 将Wcf服务发布到远程服务器后出现缓冲区大小错误

C# 将Wcf服务发布到远程服务器后出现缓冲区大小错误,c#,wcf,enums,buffer,iis-8.5,C#,Wcf,Enums,Buffer,Iis 8.5,刚刚创建了一个WCF服务,它将文件作为缓冲区/流发送到客户端。并用一个客户项目对其进行测试。一开始在本地主机上调试服务时,出现以下错误: 已超过传入邮件的最大邮件大小配额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性 因为我从WCF测试工具中增加了Client.config的maxBufferSize和maxReceivedMessageSize值;错误消失了。服务返回完整大小的缓冲区 然后,在发布到文件系统后,我通过复制粘贴将服务发布到远程

刚刚创建了一个WCF服务,它将文件作为缓冲区/流发送到客户端。并用一个客户项目对其进行测试。一开始在本地主机上调试服务时,出现以下错误:

已超过传入邮件的最大邮件大小配额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性

因为我从WCF测试工具中增加了Client.config的maxBufferSize和maxReceivedMessageSize值;错误消失了。服务返回完整大小的缓冲区

然后,在发布到文件系统后,我通过复制粘贴将服务发布到远程服务器。从服务器调试并调用同一函数时;服务返回空缓冲区

这是我的web.config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <compilation targetFramework="4.5.2" debug="true"/>
    <httpRuntime targetFramework="4.5.2" maxRequestLength="67108864"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="LargeBufferBehavior">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="67108864"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFileOperationService" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="524288" maxBufferSize="67108864" maxReceivedMessageSize="67108864" transferMode="StreamedRequest">
          <readerQuotas maxDepth="67108864" maxStringContentLength="67108864" maxArrayLength="67108864" maxBytesPerRead="67108864" maxNameTableCharCount="67108864"/>
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <services>
      <service behaviorConfiguration="LargeBufferBehavior" name="EbysIntegrationService.FileOperationService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileOperationService" contract="EbysIntegrationService.IFileOperationService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <client>
      <endpoint address=""
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileOperationService"
          contract="EbysIntegrationService.IFileOperationService"
          name="BasicHttpBinding_IFileOperationService" />
    </client>

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>
其中一个WCF函数返回带有字符串值和文件类型对象的列表。本地测试没有问题;List的返回值有几个元素,但远程服务器上的同一函数返回空列表。无法修复它,需要帮助


我是否错过远程服务器的web.config或IIS上的设置?是关于服务器的权限吗?我应该更改代码吗?(文件系统和数据库要求正确,其他功能正常工作)


另外,如果我违反了输入格式的规则,请道歉。

您必须增加服务器上的maxBufferSize才能解决此错误

<bindings>
<basicHttpBinding>
    <binding name="basicHttp" allowCookies="true"
             maxReceivedMessageSize="20000000" 
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
        <readerQuotas maxDepth="32" 
             maxArrayLength="200000000"
             maxStringContentLength="200000000"/>
    </binding>
</basicHttpBinding>


这些设置已经存在,但不起作用。字节数组仍然为空
<bindings>
<basicHttpBinding>
    <binding name="basicHttp" allowCookies="true"
             maxReceivedMessageSize="20000000" 
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
        <readerQuotas maxDepth="32" 
             maxArrayLength="200000000"
             maxStringContentLength="200000000"/>
    </binding>
</basicHttpBinding>