zoukankan      html  css  js  c++  java
  • WCF 已超过传入消息(65536)的最大消息大小配额 解决方案

    如是Web程序,则修改客户端Web.config

       做如下修改: //注意是客户端

    <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="ClientSoap"  maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647"/>   //注意这里的name
                </basicHttpBinding>
                <customBinding>
                    <binding name="DeviceServiceSoap12">
                        <textMessageEncoding messageVersion="Soap12" />
                        <httpTransport />
                    </binding>
                </customBinding>
            </bindings>
            <client>
                <endpoint address="http://127.0.0./DeviceService.asmx"
                    binding="basicHttpBinding" bindingConfiguration="ClientSoap"
                    contract="DeviceAgent.DeviceServiceSoap" name="ClientSoap" />                //注意这里的bindingConfiguration和name要跟上面的bing节点的name相对应
            </client>
        </system.serviceModel>
    

      

    如果是WinForm程序,请修改App.config 文件

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
        </startup>
        <system.serviceModel>
    
            <bindings>
              <basicHttpBinding>
                <binding name="BasicHttpBinding_IFileService" closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                  <security mode="None"></security>
                </binding>
              </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://10.10.80.254/FileService/Service1/"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileService"
                    contract="ServiceReference1.IFileService" name="BasicHttpBinding_IFileService" />
            </client>
        </system.serviceModel>
    </configuration>
    

      

    我服务端是WCF, 配置如下

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- サービス ライブラリ プロジェクトの展開時に、構成ファイルの内容をホストの app.config ファイルに追加する
      必要があります。System.Configuration は、ライブラリの構成ファイルをサポートしていません。 -->
      <system.serviceModel>
    
        <bindings>
          <basicHttpBinding>
            <binding closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <security mode="None"></security>
            </binding>
          </basicHttpBinding>
        </bindings>
    
        <services>
          <service name="FileService.FileService">
            <endpoint address="" binding="basicHttpBinding" contract="FileService.IFileService">
              <identity>
                <dns value="10.10.80.254" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://10.10.80.254/FileService/Service1/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- メタデータ情報の開示を避けるには、
              展開する前に下の値を false に設定します -->
              <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
              <!-- デバッグ目的で障害発生時の例外の詳細を受け取るには、
              下の値を true に設定します。例外情報の開示を避けるには、
              展開する前に false に設定します -->
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    
    </configuration>
    

      

  • 相关阅读:
    关于oracle当中数据类型转换的问题
    CASE WHEN的两种格式
    C#设置默认打印机
    运用Merge Into实现增加或更新数据
    增加或修改的存储过程
    深拷贝与浅拷贝
    sql server两种分页方法
    获取sql执行时间
    inserted触发器,一张表插入数据时,同时向另外一张表插入数据
    List<string[]> 如何去重
  • 原文地址:https://www.cnblogs.com/wzihan/p/14759727.html
Copyright © 2011-2022 走看看