We need to implement a WCF service for a customer based on WSDL service specification that the customer has delivered to us. We must implement the service so that it is can process only one request at a time. It is easy to configure the service so with throttling attributes, we are currently using this configuration.
<serviceThrottling maxConcurrentCalls="1" maxConcurrentInstances="1" maxConcurrentSessions="1" />
But the problem is, if the customer makes a request when the service is busy (the process might occasionally take up to two hours time to process), their request will timeout. But the IIS / WCF Service will still take the request into queue. (This is the core problem!) Because the customer's request timeouts, they are making new requests and we end up processing the same requests multiple times.
I need to either
- Send accept 202 status immediately when customer makes a request but still keep processing the requests one at a time. (better)
- Not to take the request to the queue and let the request timeout as it does now or send rejection immediately. (ok)
I could also manage if I could somehow discover run-time
- How many requests there are in the queue? (If I allowed processing multiple request I could discard the requests that arrive while the service is busy.)
- When was the request originally made? (I could stop processing a request that comes from the queue after certain time.)