【问题标题】:WCF bindingConfiguration IssueWCF 绑定配置问题
【发布时间】:2011-06-30 23:42:54
【问题描述】:

我收到了 maxStringCount is exceeded 错误,并且已经阅读了大量有关解决问题的内容(也就是说,如果您使用的是 http 绑定)。

我的问题,我正在使用 netTcpBinding。所以我不知道在 bindingConfiguration 中放什么。这是我的 app.config:

<services>
  <service behaviorConfiguration="ExStreamWCF.Service1Behavior"
    name="ExStreamWCF.Service1">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      contract="ExStreamWCF.IService1">
      <identity>
        <dns value="Devexstream-2.anchorgeneral.local" />
        <!--<dns value="vmwin2k3sta-tn2" />-->
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://Devexstream-2:8080/Service" />
        <!--<add baseAddress="net.tcp://vmwin2k3sta-tn2:8080/Service" />-->
      </baseAddresses>
    </host>
  </service>

有什么想法吗?

谢谢,

杰森

【问题讨论】:

    标签: wcf configuration binding maxstringcontentlength


    【解决方案1】:

    你的意思是 maxStringContentLength 吗?如果是这样,您可以在为其他绑定所做的配置文件的同一部分中进行设置 - 在 Binding 部分的 ReaderQuotas 部分中。即:

    <Bindings>
      <netTcpBinding>
        <binding name=".....>
          <readerQuotas maxStringContentLength="8192" .... />
        </binding>
      </netTcpBinding>
    </Bindings>
    

    如果你的意思是别的,你能提供更多的细节吗?

    【讨论】:

    • 如果您不指定名称属性,绑定将应用于所有 netTcpBindings。少麻烦:)
    • True...我没有在 binding 和 readerQuotas 元素上添加属性,因为它们不是我给出的示例的中心 - 我只是显示 maxStringContentLength 属性在哪里设置配置文件。
    • 我认为你的答案是正确的,我投了赞成票。我只是想指出 name 属性并不总是必需的。
    猜你喜欢
    • 2011-02-21
    • 2011-07-06
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    • 2012-03-08
    • 2011-06-05
    • 1970-01-01
    相关资源
    最近更新 更多