Home > Blockchain >  Detect when ServiceEndpoint with WebHttpBinding times out
Detect when ServiceEndpoint with WebHttpBinding times out

Time:09-17

We have a ServiceEndpoint which supports a method which returns a Stream. The Stream object returned from the method is an in memory Pipe class, which allows us to run some additional code asynchronously to read from another server and return the data.

The issue is that some of these operations take a while, and it appears that WCF is aborting the operation on the server side if it does not complete within the time span set by WebHttpBinding.SendTimeout

We know we can increase the time, but we're looking for some information on how to get notified that the timeout occurred. The only thing that we can see is that the Pipe instance has it's Close method called, but it's not clear if there is a way to know why it occurred. i.e. did client disconnect, or did call timeout.

We may want to clean up resources differently on the server depending on if it's client disconnect, or if it's WCF aborting the operation.

CodePudding user response:

If I understand you correctly, you want to print out the part of the journal you want to read.

Perhaps you can create your own trace listener and write it to the Eventlog, and if necessary add filters to the listener to get the information you want.

CodePudding user response:

You could simply measure the time until the pipe get's closed. If it comes close to WebHttpBinding.SendTimeout, you can assume, the operation is timed out. Probably not the best way, but simple. If you have control over the client code, you could catch the timeout exception and inform your service by calling another method.

  • Related