2
我在想如何禁用webHttpBinding的keepAlive。我知道我可以這樣做:以編程方式爲WebHttpBinding設置保持活動狀態
<bindings>
<customBinding>
<binding name="WebHttpWithoutKeepAlive">
<webMessageEncoding />
<httpTransport keepAliveEnabled="false" />
</binding>
</customBinding>
</bindings>
<services>
<service name="MyService" behaviorConfiguration="myServiceBehavior">
<endpoint address="http://localhost:9005/"
binding="customBinding"
bindingConfiguration="WebHttpWithoutKeepAlive"
contract="IMyService"
behaviorConfiguration="myServerEndpointBehavior"/>
</service>
</services>
我該如何以編程方式做同樣的事情?