I have created a WinService (.NET Framework 4.7.2) where I am using OwinSelfHost to expose some WebAPIs (GET APIs protected via JWT) on localhost.
From another application (in .NET 6), I am using RestClient to make calls to the WebAPIs. After a certain period of time, about 10-20 seconds, I receive this error (it’s not deterministic, but it occurs with this frequency):
System.ApplicationException: Exception of type 'System.ApplicationException' was thrown.
---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
--- End of inner exception stack trace ---
Going to C:\Windows\System32\LogFiles\HTTPERR, I verified that the specific error is this: <local ip> 65000 HTTP/1.1 GET /serv/api/controllername/endpoint - - - Connection_Abandoned_By_ReqQueue -
On the startup of the WinService, I tried to configure the following parameters following this as a guideline: Owin Self-Hosted WebApi Timeout Settings
C#
var listener = (OwinHttpListener)appBuilder.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener"];
listener.Listener.TimeoutManager.MinSendBytesPerSecond = uint.MaxValue;
listener.Listener.TimeoutManager.EntityBody = CApp.EntityBodyMinutes;
listener.Listener.TimeoutManager.DrainEntityBody = CApp.DrainEntityBodyMinutes;
listener.Listener.TimeoutManager.RequestQueue = CApp.RequestQueueMinutes;
listener.Listener.TimeoutManager.IdleConnection = CApp.IdleConnectionMinute;
listener.Listener.TimeoutManager.HeaderWait = CApp.HeaderWaitMinutes;
However, the problem persists. Do you have any other ideas?? Thanks in advance