Struttura HTTP_TRACE_EVENT
Contiene informazioni sulla traccia restituite dai provider di traccia.
Sintassi
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;
};
Members
Nome del membro | Descrizione |
---|---|
pProviderGuid |
Oggetto LPCGUID contenente l'identificatore del provider. I valori possibili includono, ma non sono limitati a, i valori nella sezione GUID di traccia definiti in Costanti di traccia. |
dwArea |
Oggetto DWORD che contiene l'area di interesse per l'evento. Il valore dell'area deve essere un intero positivo. |
pAreaGuid |
Oggetto LPCGUID che indica l'area di interesse. |
dwEvent |
Oggetto DWORD contenente l'identificatore univoco dell'evento per il provider di eventi. |
pszEventName |
Oggetto LPCWSTR contenente il nome dell'evento. Questo valore viene impostato dal provider di eventi per fornire una descrizione del tipo di evento. |
dwEventVersion |
Oggetto DWORD contenente la versione dell'evento. In genere 0 o 1, ma può contenere qualsiasi valore intero nonnegative. |
dwVerbosity |
Oggetto DWORD che esegue il mapping dei valori numerici alle controparti dettagliate (i valori da 0 a 5 mappano a Generale, FatalError, Error, Warning, Info e Verbose). |
pActivityGuid |
Oggetto LPCGUID contenente l'identificatore di richiesta univoco. |
pRelatedActivityGuid |
Oggetto LPCGUID contenente un valore per l'associazione di attività correlate. La maggior parte dei provider imposta questo valore su NULL e quindi consente a IIS di popolare il valore prima di inviare l'evento ai listener eventi. |
dwTimeStamp |
Oggetto DWORD contenente il timestamp facoltativo, rappresentato da un conteggio di tick interno. |
dwFlags |
Oggetto DWORD contenente flag aggiuntivi. La maggior parte dei provider imposta questo valore su HTTP_TRACE_EVENT_FLAG_STATIC_DESCRIPTIVE_FIELDS, descritta nella sezione Costanti di traccia definita in Costanti di traccia. |
cEventItems |
Oggetto DWORD contenente il numero di elementi nella pEventItems matrice. |
pEventItems |
Matrice di strutture HTTP_TRACE_EVENT_ITEM Struttura di lunghezza cEventItems . |
Commenti
La maggior parte dei membri della HTTP_TRACE_EVENT
struttura viene mappata direttamente agli eventi Event Tracing for Windows (ETW). I dwArea
membri e pAreaGuid
sono univoci per IIS.
Le classi derivate CGlobalModule che registrano per i tipi di eventi GL_TRACE_EVENT ricevono un puntatore IGlobalTraceEventProvider come parametro nel metodo pure CGlobalModule::OnGlobalTraceEvent purevirtual
. È quindi possibile recuperare un HTTP_TRACE_EVENT
puntatore chiamando il metodo IGlobalTraceEventProvider::GetTraceEvent , per il quale si specifica un puntatore all'indirizzo di una struttura NULL HTTP_TRACE_EVENT
.
Per altre informazioni, vedere Costanti di traccia.
I dwArea
membri e pAreaGuid
contengono due costanti diverse per l'area di interesse per un evento.
Esempio
Nell'esempio seguente viene popolata la HTTP_TRACE_EVENT
struttura e viene chiamato il metodo 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 );
};
};
};
Se la traccia della richiesta non riuscita è configurata correttamente, verranno visualizzati gli NOTIFY_MODULE_START
eventi e NOTIFY_MODULE_END
nel log di traccia. Per altre informazioni sulla registrazione delle richieste non riuscite, vedere Configurazione della traccia per le richieste non riuscite in IIS 7.0. Il codice XML seguente è la NOTIFY_MODULE_START
parte del log di traccia delle richieste non riuscite. La maggior parte dei dati dipende dal sistema e non corrisponderà all'evento seguente.
<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>
Requisiti
Tipo | Descrizione |
---|---|
Client | - IIS 7.0 in Windows Vista - IIS 7.5 in Windows 7 - IIS 8.0 in Windows 8 - IIS 10.0 in Windows 10 |
Server | - IIS 7.0 in Windows Server 2008 - IIS 7.5 in Windows Server 2008 R2 - IIS 8.0 in Windows Server 2012 - IIS 8.5 in Windows Server 2012 R2 - IIS 10.0 in Windows Server 2016 |
Prodotto | - 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 |
Intestazione | Httptrace.h |