In my team, we have an exposed service called AdesfaService, which includes a method named Authorization. This method is used to handle medication consumption authorizations from pharmacies. It is a SOAP service implemented with WCF. The service works as expected most of the time, but occasionally, we encounter an exception from RoutingService (I understand that RoutingService is something configured within the same project, but I am not familiar with its implementation, as I did not work on it).
System.Net.WebException
Message: The request was aborted: The request was canceled.
Stacktrace:
System.Net.HttpWebRequest.EndGetResponse
System.ServiceModel.Channels.HttpChannelFactory1+HttpRequestChannel+HttpChannelAsyncRequest.CompleteGetResponse
System.ServiceModel.Channels.HttpChannelFactory1+HttpRequestChannel+HttpChannelAsyncRequest.OnGetResponse
System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame
System.Net.LazyAsyncResult.Complete
System.Threading.ExecutionContext.RunInternal
System.Threading.ExecutionContext.Run
System.Threading.ExecutionContext.Run
System.Net.ContextAwareResult.Complete
System.Net.LazyAsyncResult.ProtectedInvokeCallback
System.Net.HttpWebRequest.SetResponse
System.Net.ConnectionReturnResult.SetResponses
System.Net.Connection.AbortOrDisassociate
System.Net.HttpWebRequest.Abort
System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput.Abort
System.ServiceModel.Channels.HttpChannelFactory1+HttpRequestChannel+HttpChannelAsyncRequest.AbortSend
System.Runtime.IOThreadScheduler+ScheduledOverlapped.IOCallback
System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame
System.Threading._IOCompletionCallback.PerformIOCompletionCallback
Example: When we compare the execution times of RoutingService and AdesfaService, it looks like this:
RoutingService: Fails with a 500 error (250ms). The pharmacy perceives this as a rejection. AdesfaService: Successfully completes (750ms), and the authorization is saved without being aware of the previous failure. I don't understand where the issue might be. I tried using Apache JMeter to overload the server but could not reproduce the error. Below is my configuration:
<service name="PServices.Services.Drugstore.Adesfa.AdesfaService" behaviorConfiguration="AdesfaBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MaxSizeBinding" contract="PServices.Services.Contract.Drugstore.Adesfa.IAdesfaService" />
</service>
<binding name="MaxSizeBinding" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
maxReceivedMessageSize="2147483647" />
The service is consumed correctly, but it fails intermittently with days in between.
I already tried modifying my configuration files to set a short default response time in case that was the issue, but it wasn’t. I even tried canceling the request manually, but I still can't reproduce that 500 error locally.