Compartir a través de


estructura de HTTP_TRACE_EVENT

Contiene información de seguimiento devuelta por proveedores de seguimiento.

Sintaxis

struct HTTP_TRACE_EVENT{  
   LPCGUID pProviderGuid;  
   DWORD dwArea;  
   LPCGUID pAreaGuid;  
   DWORD dwEvent;  
   LPCWSTR pszEventName;  
   DWORD dwEventVersion;  
   DWORD dwVerbosity;  
   LPCGUID pActivityGuid;  
   LPCGUID pRelatedActivityGuid;  
   DWORD dwTimeStamp;  
   DWORD dwFlags;  
   DWORD cEventItems;  
   __field_ecount(cEventItems) HTTP_TRACE_EVENT_ITEM * pEventItems;  
};  

Miembros

Nombre del miembro Descripción
pProviderGuid que LPCGUID contiene el identificador del proveedor. Entre los valores posibles se incluyen, entre otros, los valores de la sección GUID de seguimiento definidos en Constantes de seguimiento.
dwArea que DWORD contiene el área de interés del evento. El valor de área debe ser un entero positivo.
pAreaGuid que LPCGUID indica el área de interés.
dwEvent que DWORD contiene el identificador único del evento para el proveedor de eventos.
pszEventName que LPCWSTR contiene el nombre del evento. El proveedor de eventos establece este valor para proporcionar una descripción del tipo de evento.
dwEventVersion que DWORD contiene la versión del evento. Normalmente 0 o 1, pero puede contener cualquier valor entero no negativo.
dwVerbosity que DWORD asigna valores numéricos a sus homólogos detallados (los valores del 0 al 5 se asignan a General, FatalError, Error, Warning, Info y Verbose).
pActivityGuid que LPCGUID contiene el identificador de solicitud único.
pRelatedActivityGuid que LPCGUID contiene un valor para asociar actividades relacionadas. La mayoría de los proveedores establecen este valor en NULL y, a continuación, permiten que IIS rellene el valor antes de enviar el evento a los agentes de escucha de eventos.
dwTimeStamp que DWORD contiene la marca de tiempo opcional, representada por un recuento de tics interno.
dwFlags que DWORD contiene marcas adicionales. La mayoría de los proveedores establecen este valor en HTTP_TRACE_EVENT_FLAG_STATIC_DESCRIPTIVE_FIELDS, que se describe en la sección Constantes de seguimiento definidas en Constantes de seguimiento.
cEventItems que DWORD contiene el número de elementos de la pEventItems matriz.
pEventItems Matriz de HTTP_TRACE_EVENT_ITEM Estructuras de estructura de longitud cEventItems.

Comentarios

La mayoría de los miembros de la HTTP_TRACE_EVENT estructura se asignan directamente a eventos de Seguimiento de eventos para Windows (ETW). Los dwArea miembros y pAreaGuid son únicos para IIS.

Las clases derivadas de CGlobalModule que se registran para GL_TRACE_EVENT tipos de eventos reciben un puntero IGlobalTraceEventProvider como parámetro en el método puro virtualCGlobalModule::OnGlobalTraceEvent. A continuación, puede recuperar un HTTP_TRACE_EVENT puntero llamando al método IGlobalTraceEventProvider::GetTraceEvent para el que se proporciona un puntero a la dirección de una estructura NULL HTTP_TRACE_EVENT .

Para obtener más información, vea Seguimiento de constantes.

Los dwArea miembros y pAreaGuid contienen dos constantes diferentes para el área de interés de un evento.

Ejemplo

En el ejemplo siguiente se rellena la HTTP_TRACE_EVENT estructura y se llama al método IHttpTraceContext::RaiseTraceEvent .

REQUEST_NOTIFICATION_STATUS
CMyHttpModule::OnBeginRequest(
    IHttpContext*       pHttpContext,
    IHttpEventProvider* pProvider
)
{
    HRESULT hr;

    static long cnt;
    InterlockedIncrement(&cnt);  // keep track of how many times we are called
    cnt++;

    IHttpRequest *pRequest = pHttpContext->GetRequest();
    PCWSTR url = pRequest->GetRawHttpRequest()->CookedUrl.pAbsPath;
    OutputDebugStringW(url);

    // return unless requesting a HTML file

    if (!wcsstr(url, L".htm"))
        return RQ_NOTIFICATION_CONTINUE;

    IHttpResponse * pHttpResponse = pHttpContext->GetResponse();

    // Return most times so we can still view content
    if ((cnt % 5) || pHttpResponse == NULL)
        return RQ_NOTIFICATION_CONTINUE;

    TRC_MSG_FULL("HTML  cnt = " << cnt);

    static int insertPosCnt;
    int insertPos = ++insertPosCnt % 2 - 1;    // toggle between 0 and -1

    // Use ostringstream to create some dynamic content
    std::ostringstream os;

    os << "<p /> first chunk  callback count = " << cnt
        << " insertPos = " << insertPos << "<br />";

    // 
    // WECbyRefChunk does all the work of inserting data into the response
    //

    hr = WECbyRefChunk(os, pHttpContext, pProvider, insertPos);
    if (FAILED(hr))
        return RQ_NOTIFICATION_FINISH_REQUEST;

    os << "<br /> <b> Adding 2nd chunk in Bold </b> File insertPos = " << insertPos;
    hr = WECbyRefChunk(os, pHttpContext, pProvider, insertPos);
    if (FAILED(hr))
        return RQ_NOTIFICATION_FINISH_REQUEST;

    os << " <p /> Last (3rd) Chunk added with default append chunk  GetCurrentThreadId = "
        << GetCurrentThreadId();

    // any errors will be logged/handled in  WECbyRefChunk
    WECbyRefChunk(os, pHttpContext, pProvider);

    // End additional processing, not because of error, but so another request
    // (from a GIF or .css style sheet on the same HTML page)
    // doesn't wipe out our WriteEntityChunkByReference. We can also get the
    // WriteEntityChunkByReference prepended to our normal HTML page. 

    return RQ_NOTIFICATION_FINISH_REQUEST;

}

class My_Events
{
public:
    static	LPCGUID	GetAreaGuid( VOID ){ //  GUID for the event class
        static const GUID AreaGuid = 
        {0xacade3b2,0xb7d7,0x4339,{0x95,0x6c,0x81,0x1b,0x4e,0xdb,0x1b,0x24}};
        return &AreaGuid;
    };

    static	LPCGUID	GetProviderGuid( VOID ){ // GUID for the event Provider
        static const GUID PrvderGuid = 
        // {EB881638-214A-4f2a-9B39-933770822D18}
    { 0xeb881638, 0x214a, 0x4f2a, { 0x9b, 0x39, 0x93, 0x37, 0x70, 0x82, 0x2d, 0x18 } };
;
        return &PrvderGuid;
    };


    class My_COMPLETION
    {
    public:
        static	HRESULT	RaiseEvent(
            IHttpTraceContext * pHttpTraceContext,
            LONG InsertPosition
            )
            //
            // Raise Cmy_COMPLETION Event
            //
        {
            HTTP_TRACE_EVENT Event;
            Event.pProviderGuid = My_Events::GetProviderGuid();
            Event.dwArea = 1;
            Event.pAreaGuid = My_Events::GetAreaGuid();
            Event.dwEvent = 1;
            Event.pszEventName = L"NOTIFY_MY_CSTM_WECBR_EVNT";
            Event.dwEventVersion = 2;
            Event.dwVerbosity = 1;
            Event.cEventItems = 1;
            Event.pActivityGuid = NULL;
            Event.pRelatedActivityGuid = NULL;
            Event.dwTimeStamp = 0;
            Event.dwFlags = HTTP_TRACE_EVENT_FLAG_STATIC_DESCRIPTIVE_FIELDS;

            // pActivityGuid, pRelatedActivityGuid, Timestamp to be filled in by IIS

            HTTP_TRACE_EVENT_ITEM Items[ 1 ];
            Items[ 0 ].pszName = L"InsertPosition";
            Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LONG; // mof type (object)
#pragma warning (disable:4312)
            Items[ 0 ].pbData = (PBYTE) InsertPosition;
            Items[ 0 ].cbData = 4;
            Items[ 0 ].pszDataDescription = L"Insert Position";
            Event.pEventItems = Items;
            return pHttpTraceContext->RaiseTraceEvent( &Event );
        };

    };
};

Si el seguimiento de solicitudes con error está configurado correctamente, verá los NOTIFY_MODULE_START eventos y NOTIFY_MODULE_END en el registro de seguimiento. Para obtener más información sobre el registro de solicitudes con error, vea Configuring Tracing for Failed Requests in IIS 7.0 (Configuración del seguimiento de solicitudes con error en IIS 7.0). El código XML siguiente es la NOTIFY_MODULE_START parte del registro de seguimiento de solicitudes con error. La mayoría de los datos dependen del sistema y no coincidirán con el evento siguiente.

   <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">  
 <System>  
  <Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>  
  <EventID>0</EventID>  
  <Version>1</Version>  
  <Level>5</Level>  
  <Opcode>1</Opcode>  
  <Keywords>0x100</Keywords>  
  <TimeCreated SystemTime="2007-08-27T21:10:30.186Z"/>  
  <Correlation ActivityID="{00000000-0000-0000-9800-0080000000FA}"/>  
  <Execution ProcessID="1308" ThreadID="3608"/>  
  <Computer>N2-IIS</Computer>  
 </System>  
 <EventData>  
  <Data Name="ContextId">{00000000-0000-0000-9800-0080000000FA}</Data>  
  <Data Name="ModuleName">A_raizeEvent</Data>  
  <Data Name="Notification">1</Data>  
  <Data Name="fIsPostNotification">false</Data>  
  <Data Name="fIsCompletion">false</Data>  
 </EventData>  
 <RenderingInfo Culture="en-US">  
  <Opcode>NOTIFY_MODULE_START</Opcode>  
  <Keywords>  
   <Keyword>RequestNotifications</Keyword>  
  </Keywords>  
  <freb:Description Data="Notification">BEGIN_REQUEST</freb:Description>  
 </RenderingInfo>  
 <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">  
  <EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>  
 </ExtendedTracingInfo>  
</Event>  

Requisitos

Tipo Descripción
Remoto - IIS 7.0 en Windows Vista
- IIS 7.5 en Windows 7
- IIS 8.0 en Windows 8
- IIS 10.0 en Windows 10
Servidor - IIS 7.0 en Windows Server 2008
- IIS 7.5 en Windows Server 2008 R2
- IIS 8.0 en Windows Server 2012
- IIS 8.5 en Windows Server 2012 R2
- IIS 10.0 en Windows Server 2016
Producto - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- IIS Express 7.5, IIS Express 8.0, IIS Express 10.0
Encabezado Httptrace.h

Consulte también

Estructuras principales del servidor web