首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >未从配置中读取WCF maxReceivedMessageSize

未从配置中读取WCF maxReceivedMessageSize
EN

Stack Overflow用户
提问于 2009-08-27 20:40:23
回答 3查看 31.6K关注 0票数 16

我有一个用于WCF服务的以下服务器端app.config:

代码语言:javascript
复制
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="default" maxReceivedMessageSize="5000000">
          <readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="Core.TOAService.Service1Behavior"
        name="Core.TOAService.TOAService">
        <endpoint address="" binding="wsHttpBinding" contract="Core.TOAService.ITOAService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/Core.TOAService/TOAService/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Core.TOAService.Service1Behavior">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="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="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

当我尝试向此服务传递一个较大的文件(仅约250KB)时,在svclog文件中记录了一个异常:

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

从配置顶部的绑定部分可以看到,我尝试将maxReceivedMessageSize设置为5000000,但服务仍然认为它设置为默认的65536。有什么想法是错误的,或者哪一个是“合适的”绑定元素?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1343628

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档