WCF .config file - something is plainly wrong

偶尔善良 提交于 2019-12-08 08:05:55

问题


Folks, I've got something wrong with this .config for my WCF. When I send data to it more than 8192 bytes (the default) it fails, telling me my "maxStringContentLength" is only 8192. I think I have it set here to 10,000,000.

Any clues?

<system.serviceModel>
 <bindings>
  <wsHttpBinding>
    <binding name="wsHttpBinding" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000" messageEncoding="Mtom">
      <readerQuotas maxDepth="200" maxStringContentLength="10000000" maxArrayLength="16384" maxBytesPerRead="10000000" maxNameTableCharCount="16384" />
    </binding>
  </wsHttpBinding>
</bindings>
<services>     
  <service name="PsychCoverage.WcfMT.Admin">
    <endpoint address="" binding="wsHttpBinding" contract="PsychCoverage.Common.IAdmin">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfMT/Admin/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior >
      <serviceMetadata httpGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="True"  />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>

回答1:


You do have it set, but you're not referencing it in the endpoint element, so .NET is using the default for wsHttpBinding (8192). Add the config you specified using the bindingConfiguration attribute of the endpoint element:

<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="PsychCoverage.Common.IAdmin">

Also, I'd recommend using a different name than wsHttpBinding to prevent confusion.



来源:https://stackoverflow.com/questions/6853013/wcf-config-file-something-is-plainly-wrong

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!