I’d like to use SS client to send WEB API calls asynchronously. My scenario is 2-tier server architecture where 2nd tier provides auditing services. I’d like at the end of the request handling in tier 1 to send audit request to tier 2 and end request handling (without waiting for results of the call to audit API of tier 2).
I’ve two questions related the scenario:
What is a best practice to send a request asynchronously? Code example will be highly appreciated.
What happens if the asynchronous request returns error? How should I handle it? My goal is to ignore it in worst case and log it into file in best case.
They just return .NET’s standard async Task<T> response which you handle Exceptions in a try/catch block if you’re awaiting them, otherwise you can manually chain on the Task response to subscribe to error responses. Other than our .NET C#/.NET ServiceClients docs, googling for async Exception examples returned a good article on different ways to handle Async Exceptions.
error CS1502: The best overloaded method match for ‘ServiceStack.ServiceClientBase.PostAsync(ServiceStack.IReturnVoid)’ has some invalid arguments
error CS1503: Argument 1: cannot convert from ‘MyDTORequest’ to ‘ServiceStack.IReturnVoid’
Is inheriting from IReturnVoid is the only way to invoke the request asynchronously?