在app.config文件中配置wcf超时
本文关键字:配置 wcf 超时 文件 app config | 更新日期: 2023-09-27 18:22:38
我想增加我的连接超时。我正在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文件的哪里?
您应该使用自定义绑定,例如在wsHttpBinding:中
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingConfig"
closeTimeout="00:00:30">
</binding>
</wsHttpBinding>
</bindings>
然后在端点中使用
<endpoint binding="wsHttpBinding"
bindingConfiguration="wsHttpBindingConfig"
contract="..."
name="...">
</endpoint>