0

This is happening very randomly and very sporadically. The only thing that we can find is that IIS HttpErr is giving a Request_Cancelled error.

We are using ASP.Net Web API and nothing is writing to the error logs and no methods are getting any exceptions.

The client connects to our web api using a post call. Is there any way to capture or at least get in more detail this "Request_Cancelled" error?

I read something about a TraceListener but I cannot get this to work. NOthing writes to the log file on IIS.

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        // etc.

        config.EnableSystemDiagnosticsTracing();

        // etc.
    }
}

<configuration>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="myListener" 
          type="System.Diagnostics.TextWriterTraceListener" 
          initializeData="E:\CompressedLogs\Service1-WebApi-TraceOutput.log" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>
Terrance Jackson
  • 606
  • 3
  • 13
  • 40
  • Tracing is only going to help you if *you* write to it. Please google a bit on how and when to write to it. You mention the log is the only piece of information you have but it's the one thing you are **not** providing to us. Please post some of the log entries (omitting any sensitive information) so we can get a better idea. – JuanR Jun 25 '21 at 01:51
  • That being said, it looks to me like the client is closing the connection. This usually happens when there is an SSL certificate issue. – JuanR Jun 25 '21 at 01:55
  • Hi @JuanR when I say log I meant when there is an exception within a method it will write that exception to the log. Nothing else is traced nor tracked unless an exception occurs within the application itself – Terrance Jackson Jun 25 '21 at 03:48
  • Request_cancelled might be a timeout, you could try to capture and analyze log: [https://stackoverflow.com/a/58109148/13336642](https://stackoverflow.com/a/58109148/13336642). – samwu Jun 25 '21 at 09:29
  • @TerranceJackson so if I understand well, you are seeing this exception written to a log? If so, where is the exception dump? Please post it. Agreed with samwu, your API may be taking too long and the request is cancelled. – JuanR Jun 25 '21 at 13:44
  • I figured it out. My program was writing an exception to the database which was also throwing an error and was going through a loop of trying to write exceptions to the db using all of the db pools – Terrance Jackson Jun 27 '21 at 15:38
  • Have you got any useful information from the log? – samwu Jun 28 '21 at 09:46
  • Yes we had to use perfmon and some other tools to find this issue – Terrance Jackson Jun 29 '21 at 20:57
  • Did you succeed? – samwu Jul 01 '21 at 09:17

0 Answers0