HTTPERR log: Request_Cancelled (while troubleshoot

2020-07-26 11:23发布

问题:

I am trying to troubleshoot a "connection was forcibly closed by the remote host" error on a WCF client accessing a WCF self-hosted service. I was looking at the httperr logs in System32\LogFiles\HTTPERR on the service-side machine and each time I see that error on my client, I see entries in the log with my service's endpoint URI. The reason is "Request_Cancelled".

I can't find anything anywhere about what that reason signifies. I can guess, but I'd like to know for sure, as it must have some relation to the errors I am seeing in my client.

What is "Request_Cancelled" in the HTTPERR log? And as a bonus, can you shed any extra light on my WCF issues?

回答1:

Request_cancelled might be a timeout.

By default it should be

OpenTimeout - 1 minute
CloseTimeout - 1 minute
SendTimeOut - 1 minute
ReceiveTimeout - 10 minute.

Try set these settings in your web.config. It will add further logging to your web service.

At your system.serviceModel section

<system.serviceModel>

....

    <diagnostics>
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000" />
    </diagnostics>     

....
</system.serviceModel>

and add system.diagnostics section. It will save a log to c:\temp\wcfServiceLog.svc

<system.diagnostics>
    <switches>
      <add name="XmlSerialization.Compilation" value="4"/>
  </switches>
   <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\wcfServiceLog.svc" />
    </sharedListeners>
  </system.diagnostics>