I have a WCF service and I defined a operation contract method called IsAlive(). The goal is to check if the client is still alive or not before the exceution of its callback function.
if (IsClientAlive())
WcfService.Callback.UIMessageOnCallback(UIMessage);
The default timeout is set to 1 minute, too long in my case. As everything happens in the same workstation, I would like to reduce it to 5 seconds so there is only a little delay in the execution.
Following the instructions here https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuring-timeout-values-on-a-binding
I modified my app.config accordingly, but the nothing changed afterwards. The IsAlive() function keeps taking 1 minute to finalize. Any idea what am I missing?
<?xml version="1.0" encoding="utf-8" ?><configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup> <system.serviceModel>
<bindings>
<wsHttpBinding>
<binding openTimeout="00:00:05"
closeTimeout="00:00:05"
sendTimeout="00:00:05"
receiveTimeout="00:01:00">
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="EEAS.Kiosk.WcfService">
<endpoint address="" binding="wsDualHttpBinding" contract="EEAS.Kiosk.IWcfService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/KioskService/WcfService/" />
</baseAddresses>
</host>
</service>
</services> </system.serviceModel></configuration>
NOTE: I had a mispelling "wsHttpBinding" when it had to be "wsDualHttpBinding". Thanks stuardt for the tip! I did the change but IsAlive() function always thrown an exception "sessionful channel timed out".
{System.ServiceModel.CommunicationObjectAbortedException: The operation 'IsAlive' could not be completed because the sessionful channel timed out waiting to receive a message. To increase the timeout, either set the receiveTimeout property on the binding in your configuration file, or set the ReceiveTimeout property on the Binding directly.
So I put the ReceiveTimeout timeout back to 1 minute but the error persists. Any idea what could be happening? I checked the variable host.State and its value is CommunicationState.Opened.
wsHttpBinding
but actually usingwsDualHttpBinding
– stuartd