WCF .config文件-明显是错误的 [英] WCF .config file - something is plainly wrong

查看:64
本文介绍了WCF .config文件-明显是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们, 我的WCF的.config文件出现问题.当我向它发送超过8192字节的数据(默认)时,它失败,告诉我我的"maxStringContentLength"仅为8192.我认为我将其设置为10,000,000.

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.

有任何线索吗?

<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>

推荐答案

您已经设置了它,但是没有在终结点元素中引用它,因此.NET对wsHttpBinding使用默认值(8192).添加您使用终结点元素的bindingConfiguration属性指定的配置:

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">

此外,我建议使用与wsHttpBinding不同的名称,以防止混淆.

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

这篇关于WCF .config文件-明显是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆