adding FREB and more ETW log (#185)
* adding FREB log and more ETW logs * add missing aspnetcore_event.h file from previous commit * Update aspnetcore_event.h change provide id as 0x8000 is used by cors
This commit is contained in:
parent
051f13f17d
commit
7117147a09
|
|
@ -154,6 +154,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Inc\aspnetcore_event.h" />
|
||||
<ClInclude Include="Inc\resource.h" />
|
||||
<ClInclude Include="Inc\application.h" />
|
||||
<ClInclude Include="Inc\applicationmanager.h" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,550 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#ifndef __ASPNETCOREEVENT_H__
|
||||
#define __ASPNETCOREEVENT_H__
|
||||
/*++
|
||||
|
||||
Module Name:
|
||||
|
||||
aspnetcore_event.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file has been generated from mof file containing
|
||||
IIS trace event descriptions
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Start of the new provider class WWWServerTraceProvider,
|
||||
// GUID: {3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}
|
||||
// Description: IIS: WWW Server
|
||||
//
|
||||
|
||||
class WWWServerTraceProvider
|
||||
{
|
||||
public:
|
||||
static
|
||||
LPCGUID
|
||||
GetProviderGuid( VOID )
|
||||
// return GUID for the current event class
|
||||
{
|
||||
static const GUID ProviderGuid =
|
||||
{0x3a2a4e84,0x4c21,0x4981,{0xae,0x10,0x3f,0xda,0x0d,0x9b,0x0f,0x83}};
|
||||
return &ProviderGuid;
|
||||
};
|
||||
enum enumAreaFlags
|
||||
{
|
||||
// AspNetCore module events
|
||||
ANCM = 0x10000
|
||||
};
|
||||
static
|
||||
LPCWSTR
|
||||
TranslateEnumAreaFlagsToString( enum enumAreaFlags EnumValue)
|
||||
{
|
||||
switch( (DWORD) EnumValue )
|
||||
{
|
||||
case 0x10000: return L"ANCM";
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
CheckTracingEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
enumAreaFlags AreaFlags,
|
||||
DWORD dwVerbosity )
|
||||
{
|
||||
HRESULT hr;
|
||||
HTTP_TRACE_CONFIGURATION TraceConfig;
|
||||
TraceConfig.pProviderGuid = GetProviderGuid();
|
||||
hr = pHttpTraceContext->GetTraceConfiguration( &TraceConfig );
|
||||
if ( FAILED( hr ) || !TraceConfig.fProviderEnabled )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ( TraceConfig.dwVerbosity >= dwVerbosity &&
|
||||
( TraceConfig.dwAreas == (DWORD) AreaFlags ||
|
||||
( TraceConfig.dwAreas & (DWORD)AreaFlags ) == (DWORD)AreaFlags ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Start of the new event class ANCMEvents,
|
||||
// GUID: {82ADEAD7-12B2-4781-BDCA-5A4B6C757191}
|
||||
// Description: ANCM runtime events
|
||||
//
|
||||
|
||||
class ANCMEvents
|
||||
{
|
||||
public:
|
||||
static
|
||||
LPCGUID
|
||||
GetAreaGuid( VOID )
|
||||
// return GUID for the current event class
|
||||
{
|
||||
static const GUID AreaGuid =
|
||||
{0x82adead7,0x12b2,0x4781,{0xbd,0xca,0x5a,0x4b,0x6c,0x75,0x71,0x91}};
|
||||
return &AreaGuid;
|
||||
};
|
||||
|
||||
//
|
||||
// Event: mof class name ANCMAppStart,
|
||||
// Description: Start application success
|
||||
// EventTypeName: ANCM_START_APPLICATION_SUCCESS
|
||||
// EventType: 1
|
||||
// EventLevel: 4
|
||||
//
|
||||
|
||||
class ANCM_START_APPLICATION_SUCCESS
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId,
|
||||
LPCWSTR pAppDescription
|
||||
)
|
||||
//
|
||||
// Raise ANCM_START_APPLICATION_SUCCESS Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 1;
|
||||
Event.pszEventName = L"ANCM_START_APPLICATION_SUCCESS";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 4;
|
||||
Event.cEventItems = 2;
|
||||
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[ 2 ];
|
||||
Items[ 0 ].pszName = L"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Items[ 1 ].pszName = L"AppDescription";
|
||||
Items[ 1 ].dwDataType = HTTP_TRACE_TYPE_LPCWSTR; // mof type (string)
|
||||
Items[ 1 ].pbData = (PBYTE) pAppDescription;
|
||||
Items[ 1 ].cbData =
|
||||
( Items[ 1 ].pbData == NULL )? 0 : ( sizeof(WCHAR) * (1 + (DWORD) wcslen( (PWSTR) Items[ 1 ].pbData ) ) );
|
||||
Items[ 1 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
4 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMAppStartFail,
|
||||
// Description: Start application failed
|
||||
// EventTypeName: ANCM_START_APPLICATION_FAIL
|
||||
// EventType: 2
|
||||
// EventLevel: 2
|
||||
//
|
||||
|
||||
class ANCM_START_APPLICATION_FAIL
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId,
|
||||
LPCWSTR pFailureDescription
|
||||
)
|
||||
//
|
||||
// Raise ANCM_START_APPLICATION_FAIL Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 2;
|
||||
Event.pszEventName = L"ANCM_START_APPLICATION_FAIL";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 2;
|
||||
Event.cEventItems = 2;
|
||||
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[ 2 ];
|
||||
Items[ 0 ].pszName = L"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Items[ 1 ].pszName = L"FailureDescription";
|
||||
Items[ 1 ].dwDataType = HTTP_TRACE_TYPE_LPCWSTR; // mof type (string)
|
||||
Items[ 1 ].pbData = (PBYTE) pFailureDescription;
|
||||
Items[ 1 ].cbData =
|
||||
( Items[ 1 ].pbData == NULL )? 0 : ( sizeof(WCHAR) * (1 + (DWORD) wcslen( (PWSTR) Items[ 1 ].pbData ) ) );
|
||||
Items[ 1 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
2 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMForwardStart,
|
||||
// Description: Start fardwarding request
|
||||
// EventTypeName: ANCM_REQUEST_FORWARD_START
|
||||
// EventType: 3
|
||||
// EventLevel: 4
|
||||
//
|
||||
|
||||
class ANCM_REQUEST_FORWARD_START
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId
|
||||
)
|
||||
//
|
||||
// Raise ANCM_REQUEST_FORWARD_START Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 3;
|
||||
Event.pszEventName = L"ANCM_REQUEST_FORWARD_START";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 4;
|
||||
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"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
4 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMForwardEnd,
|
||||
// Description: Finish forwarding request
|
||||
// EventTypeName: ANCM_REQUEST_FORWARD_END
|
||||
// EventType: 4
|
||||
// EventLevel: 4
|
||||
//
|
||||
|
||||
class ANCM_REQUEST_FORWARD_END
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId
|
||||
)
|
||||
//
|
||||
// Raise ANCM_REQUEST_FORWARD_END Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 4;
|
||||
Event.pszEventName = L"ANCM_REQUEST_FORWARD_END";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 4;
|
||||
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"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
4 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMForwardFail,
|
||||
// Description: Forwarding request failure
|
||||
// EventTypeName: ANCM_REQUEST_FORWARD_FAIL
|
||||
// EventType: 5
|
||||
// EventLevel: 2
|
||||
//
|
||||
|
||||
class ANCM_REQUEST_FORWARD_FAIL
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId,
|
||||
ULONG ErrorCode
|
||||
)
|
||||
//
|
||||
// Raise ANCM_REQUEST_FORWARD_FAIL Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 5;
|
||||
Event.pszEventName = L"ANCM_REQUEST_FORWARD_FAIL";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 2;
|
||||
Event.cEventItems = 2;
|
||||
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[ 2 ];
|
||||
Items[ 0 ].pszName = L"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Items[ 1 ].pszName = L"ErrorCode";
|
||||
Items[ 1 ].dwDataType = HTTP_TRACE_TYPE_ULONG; // mof type (uint32)
|
||||
Items[ 1 ].pbData = (PBYTE) &ErrorCode;
|
||||
Items[ 1 ].cbData = 4;
|
||||
Items[ 1 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
2 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMWinHttpCallBack,
|
||||
// Description: Receiving callback from WinHttp
|
||||
// EventTypeName: ANCM_WINHTTP_CALLBACK
|
||||
// EventType: 6
|
||||
// EventLevel: 4
|
||||
//
|
||||
|
||||
class ANCM_WINHTTP_CALLBACK
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId,
|
||||
ULONG InternetStatus
|
||||
)
|
||||
//
|
||||
// Raise ANCM_WINHTTP_CALLBACK Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 6;
|
||||
Event.pszEventName = L"ANCM_WINHTTP_CALLBACK";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 4;
|
||||
Event.cEventItems = 2;
|
||||
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[ 2 ];
|
||||
Items[ 0 ].pszName = L"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Items[ 1 ].pszName = L"InternetStatus";
|
||||
Items[ 1 ].dwDataType = HTTP_TRACE_TYPE_ULONG; // mof type (uint32)
|
||||
Items[ 1 ].pbData = (PBYTE) &InternetStatus;
|
||||
Items[ 1 ].cbData = 4;
|
||||
Items[ 1 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
4 ); //Verbosity
|
||||
};
|
||||
};
|
||||
//
|
||||
// Event: mof class name ANCMForwardEnd,
|
||||
// Description: Inprocess executing request failure
|
||||
// EventTypeName: ANCM_EXECUTE_REQUEST_FAIL
|
||||
// EventType: 7
|
||||
// EventLevel: 2
|
||||
//
|
||||
|
||||
class ANCM_EXECUTE_REQUEST_FAIL
|
||||
{
|
||||
public:
|
||||
static
|
||||
HRESULT
|
||||
RaiseEvent(
|
||||
IHttpTraceContext * pHttpTraceContext,
|
||||
LPCGUID pContextId,
|
||||
ULONG ErrorCode
|
||||
)
|
||||
//
|
||||
// Raise ANCM_EXECUTE_REQUEST_FAIL Event
|
||||
//
|
||||
{
|
||||
HTTP_TRACE_EVENT Event;
|
||||
Event.pProviderGuid = WWWServerTraceProvider::GetProviderGuid();
|
||||
Event.dwArea = WWWServerTraceProvider::ANCM;
|
||||
Event.pAreaGuid = ANCMEvents::GetAreaGuid();
|
||||
Event.dwEvent = 7;
|
||||
Event.pszEventName = L"ANCM_EXECUTE_REQUEST_FAIL";
|
||||
Event.dwEventVersion = 1;
|
||||
Event.dwVerbosity = 2;
|
||||
Event.cEventItems = 2;
|
||||
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[ 2 ];
|
||||
Items[ 0 ].pszName = L"ContextId";
|
||||
Items[ 0 ].dwDataType = HTTP_TRACE_TYPE_LPCGUID; // mof type (object)
|
||||
Items[ 0 ].pbData = (PBYTE) pContextId;
|
||||
Items[ 0 ].cbData = 16;
|
||||
Items[ 0 ].pszDataDescription = NULL;
|
||||
Items[ 1 ].pszName = L"ErrorCode";
|
||||
Items[ 1 ].dwDataType = HTTP_TRACE_TYPE_ULONG; // mof type (uint32)
|
||||
Items[ 1 ].pbData = (PBYTE) &ErrorCode;
|
||||
Items[ 1 ].cbData = 4;
|
||||
Items[ 1 ].pszDataDescription = NULL;
|
||||
Event.pEventItems = Items;
|
||||
pHttpTraceContext->RaiseTraceEvent( &Event );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
static
|
||||
BOOL
|
||||
IsEnabled(
|
||||
IHttpTraceContext * pHttpTraceContext )
|
||||
// Check if tracing for this event is enabled
|
||||
{
|
||||
return WWWServerTraceProvider::CheckTracingEnabled(
|
||||
pHttpTraceContext,
|
||||
WWWServerTraceProvider::ANCM,
|
||||
2 ); //Verbosity
|
||||
};
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
|
@ -20,4 +20,5 @@
|
|||
#define ASPNETCORE_EVENT_LOAD_CLR_FALIURE_MSG L"Application '%s' with physical root '%s' failed to load clr and managed application, ErrorCode = '0x%x."
|
||||
#define ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG L"Only one inprocess application is allowed per IIS application pool. Please assign the application '%s' to a different IIS application pool."
|
||||
#define ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG L"Mixed hosting model is not supported. Application '%s' configured with different hostingModel value '%s' other than the one of running application(s)."
|
||||
#define ASPNETCORE_EVENT_ADD_APPLICATION_ERROR_MSG L"Failed to start application '%s', ErrorCode '0x%x'."
|
||||
#define ASPNETCORE_EVENT_ADD_APPLICATION_ERROR_MSG L"Failed to start application '%s', ErrorCode '0x%x'."
|
||||
#define ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT_MSG L"Application '%s' with physical root '%s' hit unexpected managed background thread eixt, ErrorCode = '0x%x."
|
||||
|
|
@ -92,6 +92,12 @@ Language=English
|
|||
%1
|
||||
.
|
||||
|
||||
Messageid=1011
|
||||
SymbolicName=ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT
|
||||
Language=English
|
||||
%1
|
||||
.
|
||||
|
||||
;
|
||||
;#endif // _ASPNETCORE_MODULE_MSG_H_
|
||||
;
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "precomp.hxx"
|
||||
#include <dbgutil.h>
|
||||
#include <comdef.h>
|
||||
|
||||
|
||||
// Just to be aware of the FORWARDING_HANDLER object size.
|
||||
|
|
@ -1151,9 +1152,27 @@ FORWARDING_HANDLER::OnExecuteRequestHandler(
|
|||
hr = ((IN_PROCESS_APPLICATION*)m_pApplication)->LoadManagedApplication();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
_com_error err(hr);
|
||||
if (ANCMEvents::ANCM_START_APPLICATION_FAIL::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_START_APPLICATION_FAIL::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL,
|
||||
err.ErrorMessage());
|
||||
}
|
||||
|
||||
fInternalError = TRUE;
|
||||
goto Failure;
|
||||
}
|
||||
|
||||
// FREB log
|
||||
if (ANCMEvents::ANCM_START_APPLICATION_SUCCESS::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_START_APPLICATION_SUCCESS::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL,
|
||||
L"InProcess Application");
|
||||
}
|
||||
return m_pApplication->ExecuteRequest(m_pW3Context);
|
||||
}
|
||||
case HOSTING_OUT_PROCESS:
|
||||
|
|
@ -1301,6 +1320,15 @@ FORWARDING_HANDLER::OnExecuteRequestHandler(
|
|||
// async completion.
|
||||
//
|
||||
ReferenceForwardingHandler();
|
||||
|
||||
//FREB log
|
||||
if (ANCMEvents::ANCM_REQUEST_FORWARD_START::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_REQUEST_FORWARD_START::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!WinHttpSendRequest(m_hRequest,
|
||||
m_pszHeaders,
|
||||
m_cchHeaders,
|
||||
|
|
@ -1312,6 +1340,14 @@ FORWARDING_HANDLER::OnExecuteRequestHandler(
|
|||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
DebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO,
|
||||
"FORWARDING_HANDLER::OnExecuteRequestHandler, Send request failed");
|
||||
if (ANCMEvents::ANCM_REQUEST_FORWARD_FAIL::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_REQUEST_FORWARD_FAIL::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL,
|
||||
hr);
|
||||
}
|
||||
|
||||
DereferenceForwardingHandler();
|
||||
goto Failure;
|
||||
}
|
||||
|
|
@ -2078,6 +2114,14 @@ None
|
|||
NULL);
|
||||
}
|
||||
|
||||
//FREB log
|
||||
if (ANCMEvents::ANCM_WINHTTP_CALLBACK::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_WINHTTP_CALLBACK::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL,
|
||||
dwInternetStatus);
|
||||
}
|
||||
//
|
||||
// ReadLock on the winhttp handle to protect from a client disconnect/
|
||||
// server stop closing the handle while we are using it.
|
||||
|
|
@ -2341,6 +2385,15 @@ Failure:
|
|||
}
|
||||
}
|
||||
|
||||
// FREB log
|
||||
if (ANCMEvents::ANCM_REQUEST_FORWARD_FAIL::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_REQUEST_FORWARD_FAIL::RaiseEvent(
|
||||
m_pW3Context->GetTraceContext(),
|
||||
NULL,
|
||||
hr);
|
||||
}
|
||||
|
||||
Finished:
|
||||
|
||||
if (fIsCompletionThread)
|
||||
|
|
|
|||
|
|
@ -194,8 +194,10 @@ http_flush_response_bytes(
|
|||
|
||||
IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL;
|
||||
|
||||
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION():
|
||||
m_fManagedAppLoaded ( FALSE ), m_fLoadManagedAppError ( FALSE )
|
||||
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION():
|
||||
m_ProcessExitCode ( 0 ),
|
||||
m_fManagedAppLoaded ( FALSE ),
|
||||
m_fLoadManagedAppError ( FALSE )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -545,6 +547,12 @@ IN_PROCESS_APPLICATION::ExecuteRequest(
|
|||
//
|
||||
// return error as the application did not register callback
|
||||
//
|
||||
if (ANCMEvents::ANCM_EXECUTE_REQUEST_FAIL::IsEnabled(pHttpContext->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_EXECUTE_REQUEST_FAIL::RaiseEvent(pHttpContext->GetTraceContext(),
|
||||
NULL,
|
||||
E_APPLICATION_ACTIVATION_EXEC_FAILURE);
|
||||
}
|
||||
pHttpContext->GetResponse()->SetStatus(500, "Internal Server Error", 0, E_APPLICATION_ACTIVATION_EXEC_FAILURE);
|
||||
return RQ_NOTIFICATION_FINISH_REQUEST;
|
||||
}
|
||||
|
|
@ -739,11 +747,51 @@ IN_PROCESS_APPLICATION::ExecuteApplication(
|
|||
m_ProcessExitCode = pProc(2, argv);
|
||||
if (m_ProcessExitCode != 0)
|
||||
{
|
||||
// TODO error
|
||||
|
||||
}
|
||||
|
||||
Finished:
|
||||
// TODO log any errors
|
||||
//
|
||||
// this method is called by the background thread and should never exit unless shutdown
|
||||
//
|
||||
if (!g_fRecycleProcessCalled)
|
||||
{
|
||||
STRU strEventMsg;
|
||||
LPCWSTR apsz[1];
|
||||
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||
ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT_MSG,
|
||||
m_pConfiguration->QueryApplicationPath()->QueryStr(),
|
||||
m_pConfiguration->QueryApplicationFullPath()->QueryStr(),
|
||||
m_ProcessExitCode
|
||||
)))
|
||||
{
|
||||
apsz[0] = strEventMsg.QueryStr();
|
||||
|
||||
//
|
||||
// not checking return code because if ReportEvent
|
||||
// fails, we cannot do anything.
|
||||
//
|
||||
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
||||
{
|
||||
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
||||
EVENTLOG_ERROR_TYPE,
|
||||
0,
|
||||
ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT,
|
||||
NULL,
|
||||
1,
|
||||
0,
|
||||
apsz,
|
||||
NULL);
|
||||
}
|
||||
// error. the thread exits after application started
|
||||
// Question: should we shutdown current worker process or keep the application in failure state?
|
||||
// for now, we reccylce to keep the same behavior as that of out-of-process
|
||||
if (m_fManagedAppLoaded)
|
||||
{
|
||||
Recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ inline bool IsSpace(char ch)
|
|||
|
||||
#include "environmentvariablehash.h"
|
||||
#include "..\aspnetcore_msg.h"
|
||||
#include "aspnetcore_event.h"
|
||||
#include "aspnetcoreconfig.h"
|
||||
#include "serverprocess.h"
|
||||
#include "processmanager.h"
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,15 @@ SERVER_PROCESS::StartProcess(
|
|||
apsz,
|
||||
NULL);
|
||||
}
|
||||
|
||||
// FREB log
|
||||
if (ANCMEvents::ANCM_START_APPLICATION_SUCCESS::IsEnabled(context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_START_APPLICATION_SUCCESS::RaiseEvent(
|
||||
context->GetTraceContext(),
|
||||
NULL,
|
||||
apsz[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Finished:
|
||||
|
|
@ -1097,6 +1106,15 @@ Finished:
|
|||
apsz,
|
||||
NULL);
|
||||
}
|
||||
|
||||
// FREB log
|
||||
if (ANCMEvents::ANCM_START_APPLICATION_FAIL::IsEnabled(context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_START_APPLICATION_FAIL::RaiseEvent(
|
||||
context->GetTraceContext(),
|
||||
NULL,
|
||||
strEventMsg.QueryStr());
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr) || m_fReady == FALSE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue