【问题标题】:Setting SendTimeout in my WCF app.config在我的 WCF app.config 中设置 SendTimeout
【发布时间】:2010-09-30 07:10:18
【问题描述】:

看着我的 app.config 有点困惑,它看起来像这样:

<system.serviceModel>

<servcies>

    <service>

        <endpoint address="" binding="basicHttpBinding">
            <identity>
                           <dns value="localhost"
            </identity>
        <endpoint>

    </service>



</services>
<behaviors>
    <serviceBehaviors>

        <behavior>
            ...
        </behavior>

    </serviceBehaviors>
</beharviors>

</system.serviceModel>

我应该在哪里添加绑定标签以将 SendTimeout 值设置为大于 1 分钟?

【问题讨论】:

    标签: wcf configuration app-config


    【解决方案1】:

    您在服务器的 .config 文件中设置了一个绑定部分,就像您上一个问题中显示的 IceLava 一样:

      <bindings>
        <netTcpBinding>
        <binding name="longTimeoutBinding"
            receiveTimeout="00:10:00" sendTimeout="00:10:00">
          <security mode="None"/>
        </binding>
        </netTcpBinding>
       </bindings>
    

    在你上面的例子中,你可以把它放在你的行为之下。

    然后,在您的端点配置中,使用属性 bindingConfiguration = "longTimeoutBinding" 添加对该绑定的引用。

    类似这样的:

    <endpoint address="" bindingConfiguration="longTimeoutBinding" binding="basicHttpBinding">
            <identity>
                       <dns value="localhost" />
            </identity>
    <endpoint>
    

    如果您有 Juval Lowy 编写的 Programming WCF Services 一书,您可以在第 28-29 页(第 2 版)中查看更多信息。

    【讨论】:

      猜你喜欢
      • 2011-04-13
      • 1970-01-01
      • 2011-01-11
      • 1970-01-01
      • 1970-01-01
      • 2013-03-01
      • 2012-02-29
      • 2017-03-06
      • 2014-03-13
      相关资源
      最近更新 更多