如何使用此 WCF 联系人将 receiveTimeout 和 sendTimeout 设置为无穷大? [英] How can I set the receiveTimeout and sendTimeout to infinity with this WCF contact?
问题描述
我的主机中有以下 app.config:
I have the following app.config in my Host:
<services>
<service name="DCC_Service.DCCService" behaviorConfiguration="serviceBehavior">
<endpoint binding="netNamedPipeBinding" contract="DCC_Service.IDCCService" address="DCCService" />
<endpoint binding="mexNamedPipeBinding" contract="IMetadataExchange" address="mex" />
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
如何将 netNamedPipeBinding 超时设置为无限又名 Timespan.MaxValue
?
How do I set the netNamedPipeBinding timeouts to infinite aka Timespan.MaxValue
?
推荐答案
对各种超时值使用 infinite
- 关闭、打开、接收和发送.您可以像这样在绑定配置中指定这些超时.
Use infinite
for the various timeout values - close, open, receive, and send. You specify these timeouts in a binding configuration like so.
<bindings>
<netNamedPipeBinding>
<binding name="mybinding" closeTimeout="infinite" openTimeout="infinite"
receiveTimeout="infinite" sendTimeout="infinite" />
</netNamedPipeBinding>
</bindings>
bindings
部分与 services
和 behaviors
部分处于同一级别.唯一剩下的就是在您的服务端点中引用绑定配置.
The bindings
section goes at the same level as the services
and behaviors
sections. The only thing left is to reference the binding configuration in your service endpoint.
<services>
<service name="DCC_Service.DCCService" behaviorConfiguration="serviceBehavior">
<endpoint binding="netNamedPipeBinding"
contract="DCC_Service.IDCCService"
address="DCCService"
bindingConfiguration="mybinding"/> <!-- SEE THIS LINE -->
<endpoint binding="mexNamedPipeBinding"
contract="IMetadataExchange"
address="mex" />
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
我不记得具体(而且我现在没有时间查看),但是您可能还必须将这些内容也放入您的客户端配置中.
I don't remember specifically (and I don't have time to look right now), but you may have to put this stuff in your client configuration as well.
这篇关于如何使用此 WCF 联系人将 receiveTimeout 和 sendTimeout 设置为无穷大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!