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

问题描述:

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

`

<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

这听起来像你想实现这在服务器端使用它(如果我读错了请纠正我)。如果客户端应用程序无法首先连接,它将如何知道服务器上设置的连接超时? – 2012-02-05 02:05:30

+0

我只能在编程WCF服务中找到对事务超时的引用,而不是连接超时。 – 2012-02-05 02:13:48

+0

也http://*.com/questions/229760/timeouts-wcf-services – 2012-02-05 04:51:32

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

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

比端点

<endpoint binding="wsHttpBinding" 
      bindingConfiguration="wsHttpBindingConfig" 
      contract="..." 
      name="..."> 
</endpoint>