当前位置: 代码迷 >> Web Service >> 关于webservice传送文件过大的有关问题
  详细解决方案

关于webservice传送文件过大的有关问题

热度:216   发布时间:2016-05-02 02:56:55.0
关于webservice传送文件过大的问题
大家好,我在使用webservices传送bitmap文件时报以下错误:
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

我在网上也搜到了貌似可以解决问题的方法,但还是没能解决,据说在Web.config里添加以下代码就行,但我试过了,不行的。不知道各位有没有什么好的解决办法,谢谢:
XML code
<system.serviceModel>    <bindings>      <basicHttpBinding>        <binding name="FileServiceSoapBinding" closeTimeout="00:01:00"          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"          maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"          useDefaultWebProxy="true">          <readerQuotas maxDepth="64" maxStringContentLength="8192000" maxArrayLength="16384000"            maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />          <security mode="None">            <transport clientCredentialType="None" proxyCredentialType="None"              realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>        <binding name="FileServiceSoapBinding1" closeTimeout="00:01:00"          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"          maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"          useDefaultWebProxy="true">          <readerQuotas maxDepth="64" maxStringContentLength="8192000" maxArrayLength="16384000"            maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />          <security mode="None">            <transport clientCredentialType="None" proxyCredentialType="None"              realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>      </basicHttpBinding>    </bindings>


------解决方案--------------------
我来接分。

1、需要把相关数据序列化成字节流,再对字节流进行压缩,再进行传输,到了客户端再做反向操作便可获得原始数据。(目前做的项目正好用到。分页传输dataset,序列化字节流压缩传输。bitmap文件应该道理相通)

2、如果压缩后的数据仍然较大时,可以再压缩流后,再对流进行拆分即可。(未试过。请参考http://www.cnblogs.com/xuanfeng/archive/2008/04/16/1155700.html)


  相关解决方案