在app.config文件中配置wcf超时

时间:2012-02-05 01:47:17

标签: c# wcf web-services

我想增加连接超时。  我在Windows服务中托管我的WCF服务。 这是我的App.config文件:

`   

<services>
  <service name="Service.WebexClient"  behaviorConfiguration="MyServiceTypeBehaviors" >
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8413/MyWebexService"/>
      </baseAddresses>
    </host>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors" >
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

  ` 我想增加时间,将此配置放在app.config文件中的哪个位置?

1 个答案:

答案 0 :(得分:3)

您应该使用自定义绑定,例如在wsHttpBinding:

<bindings>
  <wsHttpBinding>
    <binding name="wsHttpBindingConfig"
         closeTimeout="00:00:30">
    </binding>
  </wsHttpBinding>
</bindings>

比在端点

中使用它
<endpoint binding="wsHttpBinding"
          bindingConfiguration="wsHttpBindingConfig"
          contract="..."
          name="...">
</endpoint>