Panwang/addinglog (#508)
* adding windows event log * adding windows event log * fix a wrong bool variable * some updates * fix bad merge
This commit is contained in:
parent
8707d71f1e
commit
7b65bdb6ef
|
|
@ -52,6 +52,8 @@ x64/
|
||||||
src/AspNetCore/aspnetcore_msg.h
|
src/AspNetCore/aspnetcore_msg.h
|
||||||
src/AspNetCore/aspnetcore_msg.rc
|
src/AspNetCore/aspnetcore_msg.rc
|
||||||
src/AspNetCore/version.h
|
src/AspNetCore/version.h
|
||||||
|
src/CommonLib/aspnetcore_msg.h
|
||||||
|
src/CommonLib/aspnetcore_msg.rc
|
||||||
.build
|
.build
|
||||||
|
|
||||||
*.VC.*db
|
*.VC.*db
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,6 @@
|
||||||
<ClInclude Include="Inc\applicationinfo.h" />
|
<ClInclude Include="Inc\applicationinfo.h" />
|
||||||
<ClInclude Include="Inc\appoffline.h" />
|
<ClInclude Include="Inc\appoffline.h" />
|
||||||
<ClInclude Include="inc\globalmodule.h" />
|
<ClInclude Include="inc\globalmodule.h" />
|
||||||
<ClInclude Include="Inc\resource.h" />
|
|
||||||
<ClInclude Include="Inc\applicationmanager.h" />
|
<ClInclude Include="Inc\applicationmanager.h" />
|
||||||
<ClInclude Include="Inc\filewatcher.h" />
|
<ClInclude Include="Inc\filewatcher.h" />
|
||||||
<ClInclude Include="Inc\proxymodule.h" />
|
<ClInclude Include="Inc\proxymodule.h" />
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,21 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
||||||
// recycle the application
|
// recycle the application
|
||||||
if (m_pApplication != NULL)
|
if (m_pApplication != NULL)
|
||||||
{
|
{
|
||||||
|
STACK_STRU(strEventMsg, 256);
|
||||||
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
|
||||||
|
m_pApplication->QueryConfig()->QueryApplicationPath()->QueryStr())))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
m_pApplication->ShutDown();
|
m_pApplication->ShutDown();
|
||||||
m_pApplication->DereferenceApplication();
|
m_pApplication->DereferenceApplication();
|
||||||
m_pApplication = NULL;
|
m_pApplication = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ APPLICATION_MANAGER::GetApplicationInfo(
|
||||||
BOOL fMixedHostingModelError = FALSE;
|
BOOL fMixedHostingModelError = FALSE;
|
||||||
BOOL fDuplicatedInProcessApp = FALSE;
|
BOOL fDuplicatedInProcessApp = FALSE;
|
||||||
PCWSTR pszApplicationId = NULL;
|
PCWSTR pszApplicationId = NULL;
|
||||||
LPCWSTR apsz[1];
|
|
||||||
STACK_STRU ( strEventMsg, 256 );
|
STACK_STRU ( strEventMsg, 256 );
|
||||||
|
|
||||||
*ppApplicationInfo = NULL;
|
*ppApplicationInfo = NULL;
|
||||||
|
|
@ -153,42 +152,24 @@ Finished:
|
||||||
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG,
|
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG,
|
||||||
pszApplicationId)))
|
pszApplicationId)))
|
||||||
{
|
{
|
||||||
/*apsz[0] = strEventMsg.QueryStr();
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
EVENTLOG_ERROR_TYPE,
|
||||||
{
|
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP,
|
||||||
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
strEventMsg.QueryStr());
|
||||||
EVENTLOG_ERROR_TYPE,
|
|
||||||
0,
|
|
||||||
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP,
|
|
||||||
NULL,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
apsz,
|
|
||||||
NULL);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fMixedHostingModelError)
|
else if (fMixedHostingModelError)
|
||||||
{
|
{
|
||||||
//if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
// ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG,
|
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG,
|
||||||
// pszApplicationId,
|
pszApplicationId,
|
||||||
// pConfig->QueryHostingModelStr())))
|
pConfig->QueryHostingModel())))
|
||||||
//{
|
{
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// /*if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
EVENTLOG_ERROR_TYPE,
|
||||||
// {
|
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR,
|
||||||
// ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
strEventMsg.QueryStr());
|
||||||
// EVENTLOG_ERROR_TYPE,
|
}
|
||||||
// 0,
|
|
||||||
// ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// apsz,
|
|
||||||
// NULL);
|
|
||||||
// }*/
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -197,19 +178,10 @@ Finished:
|
||||||
pszApplicationId,
|
pszApplicationId,
|
||||||
hr)))
|
hr)))
|
||||||
{
|
{
|
||||||
apsz[0] = strEventMsg.QueryStr();
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
/*if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
EVENTLOG_ERROR_TYPE,
|
||||||
{
|
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR,
|
||||||
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
strEventMsg.QueryStr());
|
||||||
EVENTLOG_ERROR_TYPE,
|
|
||||||
0,
|
|
||||||
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR,
|
|
||||||
NULL,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
apsz,
|
|
||||||
NULL);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
HTTP_MODULE_ID g_pModuleId = NULL;
|
HTTP_MODULE_ID g_pModuleId = NULL;
|
||||||
IHttpServer * g_pHttpServer = NULL;
|
IHttpServer * g_pHttpServer = NULL;
|
||||||
|
HANDLE g_hEventLog = NULL;
|
||||||
BOOL g_fRecycleProcessCalled = FALSE;
|
BOOL g_fRecycleProcessCalled = FALSE;
|
||||||
PCWSTR g_pszModuleName = NULL;
|
PCWSTR g_pszModuleName = NULL;
|
||||||
HINSTANCE g_hModule;
|
HINSTANCE g_hModule;
|
||||||
|
|
@ -25,6 +26,11 @@ VOID
|
||||||
StaticCleanup()
|
StaticCleanup()
|
||||||
{
|
{
|
||||||
APPLICATION_MANAGER::Cleanup();
|
APPLICATION_MANAGER::Cleanup();
|
||||||
|
if (g_hEventLog != NULL)
|
||||||
|
{
|
||||||
|
DeregisterEventSource(g_hEventLog);
|
||||||
|
g_hEventLog = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HMODULE hModule,
|
BOOL WINAPI DllMain(HMODULE hModule,
|
||||||
|
|
@ -100,6 +106,15 @@ HRESULT
|
||||||
g_pszModuleName = pModuleInfo->GetName();
|
g_pszModuleName = pModuleInfo->GetName();
|
||||||
g_pHttpServer = pHttpServer;
|
g_pHttpServer = pHttpServer;
|
||||||
|
|
||||||
|
if (g_pHttpServer->IsCommandLineLaunch())
|
||||||
|
{
|
||||||
|
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_IISEXPRESS_EVENT_PROVIDER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_EVENT_PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
// check whether the feature is disabled due to security reason
|
// check whether the feature is disabled due to security reason
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
||||||
|
|
@ -127,6 +142,17 @@ HRESULT
|
||||||
if (fDisableANCM)
|
if (fDisableANCM)
|
||||||
{
|
{
|
||||||
// Logging
|
// Logging
|
||||||
|
STACK_STRU(strEventMsg, 256);
|
||||||
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
|
ASPNETCORE_EVENT_MODULE_DISABLED_MSG)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_WARNING_TYPE,
|
||||||
|
ASPNETCORE_EVENT_MODULE_DISABLED,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
// this will return 500 error to client
|
||||||
|
// as we did not register the module
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,14 +108,14 @@ inline bool IsSpace(char ch)
|
||||||
#include "..\..\CommonLib\utility.h"
|
#include "..\..\CommonLib\utility.h"
|
||||||
#include "..\..\CommonLib\debugutil.h"
|
#include "..\..\CommonLib\debugutil.h"
|
||||||
#include "..\..\CommonLib\requesthandler.h"
|
#include "..\..\CommonLib\requesthandler.h"
|
||||||
//#include "..\aspnetcore_msg.h"
|
#include "..\..\CommonLib\resources.h"
|
||||||
|
#include "..\..\CommonLib\aspnetcore_msg.h"
|
||||||
//#include "aspnetcore_event.h"
|
//#include "aspnetcore_event.h"
|
||||||
#include "appoffline.h"
|
#include "appoffline.h"
|
||||||
#include "filewatcher.h"
|
#include "filewatcher.h"
|
||||||
#include "applicationinfo.h"
|
#include "applicationinfo.h"
|
||||||
#include "applicationmanager.h"
|
#include "applicationmanager.h"
|
||||||
#include "globalmodule.h"
|
#include "globalmodule.h"
|
||||||
#include "resource.h"
|
|
||||||
#include "proxymodule.h"
|
#include "proxymodule.h"
|
||||||
#include "applicationinfo.h"
|
#include "applicationinfo.h"
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ extern HINSTANCE g_hModule;
|
||||||
extern HMODULE g_hAspnetCoreRH;
|
extern HMODULE g_hAspnetCoreRH;
|
||||||
extern SRWLOCK g_srwLock;
|
extern SRWLOCK g_srwLock;
|
||||||
extern PCWSTR g_pwzAspnetcoreRequestHandlerName;
|
extern PCWSTR g_pwzAspnetcoreRequestHandlerName;
|
||||||
|
extern HANDLE g_hEventLog;
|
||||||
extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
||||||
extern PFN_ASPNETCORE_CREATE_REQUEST_HANDLER g_pfnAspNetCoreCreateRequestHandler;
|
extern PFN_ASPNETCORE_CREATE_REQUEST_HANDLER g_pfnAspNetCoreCreateRequestHandler;
|
||||||
#pragma warning( error : 4091)
|
#pragma warning( error : 4091)
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,7 @@
|
||||||
<ClInclude Include="fx_ver.h" />
|
<ClInclude Include="fx_ver.h" />
|
||||||
<ClInclude Include="hostfxr_utility.h" />
|
<ClInclude Include="hostfxr_utility.h" />
|
||||||
<ClInclude Include="requesthandler.h" />
|
<ClInclude Include="requesthandler.h" />
|
||||||
|
<ClInclude Include="resources.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="utility.h" />
|
<ClInclude Include="utility.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
@ -199,6 +200,23 @@
|
||||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="aspnetcore_msg.mc">
|
||||||
|
<FileType>Document</FileType>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,18 @@ Language=English
|
||||||
%1
|
%1
|
||||||
.
|
.
|
||||||
|
|
||||||
|
Messageid=1012
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_RECYCLE_APPOFFLINE
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1013
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_MODULE_DISABLED
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
;
|
;
|
||||||
;#endif // _ASPNETCORE_MODULE_MSG_H_
|
;#endif // _ASPNETCORE_MODULE_MSG_H_
|
||||||
;
|
;
|
||||||
|
|
@ -6,12 +6,15 @@
|
||||||
#define IDS_INVALID_PROPERTY 1000
|
#define IDS_INVALID_PROPERTY 1000
|
||||||
#define IDS_SERVER_ERROR 1001
|
#define IDS_SERVER_ERROR 1001
|
||||||
|
|
||||||
|
#define ASPNETCORE_EVENT_PROVIDER L"IIS AspNetCore Module"
|
||||||
|
#define ASPNETCORE_IISEXPRESS_EVENT_PROVIDER L"IIS Express AspNetCore Module"
|
||||||
|
|
||||||
#define ASPNETCORE_EVENT_MSG_BUFFER_SIZE 256
|
#define ASPNETCORE_EVENT_MSG_BUFFER_SIZE 256
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG L"Application '%s' started process '%d' successfully and is listening on port '%d'."
|
#define ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG L"Application '%s' started process '%d' successfully and is listening on port '%d'."
|
||||||
#define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG L"Maximum rapid fail count per minute of '%d' exceeded."
|
#define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG L"Maximum rapid fail count per minute of '%d' exceeded."
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG L"Application '%s' failed to parse processPath and arguments due to internal error, ErrorCode = '0x%x'."
|
#define ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG L"Application '%s' failed to parse processPath and arguments due to internal error, ErrorCode = '0x%x'."
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s'but failed to get its status, ErrorCode = '0x%x'."
|
#define ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s'but failed to get its status, ErrorCode = '0x%x', retryCounter '%d'."
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s', ErrorCode = '0x%x' processStatus code '%x'."
|
#define ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s', ErrorCode = '0x%x', retryCounter '%d'."
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_WRONGPORT_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but failed to listen on the given port '%d'"
|
#define ASPNETCORE_EVENT_PROCESS_START_WRONGPORT_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but failed to listen on the given port '%d'"
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_NOTREADY_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but either crashed or did not reponse or did not listen on the given port '%d', ErrorCode = '0x%x'"
|
#define ASPNETCORE_EVENT_PROCESS_START_NOTREADY_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but either crashed or did not reponse or did not listen on the given port '%d', ErrorCode = '0x%x'"
|
||||||
#define ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG L"Warning: Could not create stdoutLogFile %s, ErrorCode = %d."
|
#define ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG L"Warning: Could not create stdoutLogFile %s, ErrorCode = %d."
|
||||||
|
|
@ -19,6 +22,8 @@
|
||||||
#define ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST_MSG L"Sent shutdown HTTP message to process '%d' and received http status '%d'."
|
#define ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST_MSG L"Sent shutdown HTTP message to process '%d' and received http status '%d'."
|
||||||
#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_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_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_MIXED_HOSTING_MODEL_ERROR_MSG L"Mixed hosting model is not supported. Application '%s' configured with different hostingModel value '%d' 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 exit, 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."
|
||||||
|
#define ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG L"Application '%s' is recycled due to app_offline file was detected."
|
||||||
|
#define ASPNETCORE_EVENT_MODULE_DISABLED_MSG L"AspNetCore Module is disabled"
|
||||||
|
|
@ -599,3 +599,31 @@ UTILITY::CheckIfFileExists(
|
||||||
|
|
||||||
return fFileExists;
|
return fFileExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
UTILITY::LogEvent(
|
||||||
|
_In_ HANDLE hEventLog,
|
||||||
|
_In_ WORD dwEventInfoType,
|
||||||
|
_In_ DWORD dwEventId,
|
||||||
|
_In_ LPCWSTR pstrMsg
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (hEventLog != NULL)
|
||||||
|
{
|
||||||
|
ReportEventW(hEventLog,
|
||||||
|
dwEventInfoType,
|
||||||
|
0, // wCategory
|
||||||
|
dwEventId,
|
||||||
|
NULL, // lpUserSid
|
||||||
|
1, // wNumStrings
|
||||||
|
0, // dwDataSize,
|
||||||
|
&pstrMsg,
|
||||||
|
NULL // lpRawData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwEventInfoType == EVENTLOG_ERROR_TYPE)
|
||||||
|
{
|
||||||
|
fwprintf(stderr, L"ERROR: %s\n", pstrMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -111,8 +111,17 @@ public:
|
||||||
PCWSTR pszFilePath
|
PCWSTR pszFilePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
LogEvent(
|
||||||
|
_In_ HANDLE hEventLog,
|
||||||
|
_In_ WORD dwEventInfoType,
|
||||||
|
_In_ DWORD dwEventId,
|
||||||
|
_In_ LPCWSTR pstrMsg
|
||||||
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UTILITY() {}
|
UTILITY() {}
|
||||||
~UTILITY() {}
|
~UTILITY() {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -201,7 +201,7 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="aspnetcore_event.h" />
|
<ClInclude Include="aspnetcore_event.h" />
|
||||||
<ClInclude Include="aspnetcore_msg.h" />
|
<ClInclude Include="disconnectcontext.h" />
|
||||||
<ClInclude Include="sttimer.h" />
|
<ClInclude Include="sttimer.h" />
|
||||||
<ClInclude Include="outofprocess\forwarderconnection.h" />
|
<ClInclude Include="outofprocess\forwarderconnection.h" />
|
||||||
<ClInclude Include="outofprocess\processmanager.h" />
|
<ClInclude Include="outofprocess\processmanager.h" />
|
||||||
|
|
@ -211,7 +211,6 @@
|
||||||
<ClInclude Include="outofprocess\websockethandler.h" />
|
<ClInclude Include="outofprocess\websockethandler.h" />
|
||||||
<ClInclude Include="outofprocess\winhttphelper.h" />
|
<ClInclude Include="outofprocess\winhttphelper.h" />
|
||||||
<ClInclude Include="precomp.hxx" />
|
<ClInclude Include="precomp.hxx" />
|
||||||
<ClInclude Include="resource.h" />
|
|
||||||
<ClInclude Include=".\inprocess\inprocessapplication.h" />
|
<ClInclude Include=".\inprocess\inprocessapplication.h" />
|
||||||
<ClInclude Include=".\inprocess\inprocesshandler.h" />
|
<ClInclude Include=".\inprocess\inprocesshandler.h" />
|
||||||
<ClInclude Include=".\outofprocess\forwardinghandler.h" />
|
<ClInclude Include=".\outofprocess\forwardinghandler.h" />
|
||||||
|
|
@ -232,23 +231,6 @@
|
||||||
<ClCompile Include="outofprocess\websockethandler.cxx" />
|
<ClCompile Include="outofprocess\websockethandler.cxx" />
|
||||||
<ClCompile Include="outofprocess\winhttphelper.cxx" />
|
<ClCompile Include="outofprocess\winhttphelper.cxx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<CustomBuild Include="aspnetcore_msg.mc">
|
|
||||||
<FileType>Document</FileType>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
|
||||||
</CustomBuild>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CommonLib\CommonLib.vcxproj">
|
<ProjectReference Include="..\CommonLib\CommonLib.vcxproj">
|
||||||
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
||||||
|
|
@ -257,9 +239,6 @@
|
||||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="RequestHandler.rc" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Source.def" />
|
<None Include="Source.def" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="precomp.hxx" />
|
<ClInclude Include="precomp.hxx" />
|
||||||
<ClInclude Include="resource.h" />
|
|
||||||
<ClInclude Include=".\inprocess\inprocessapplication.h">
|
<ClInclude Include=".\inprocess\inprocessapplication.h">
|
||||||
<Filter>InProcess</Filter>
|
<Filter>InProcess</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
@ -80,7 +79,6 @@
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="aspnetcore_event.h" />
|
<ClInclude Include="aspnetcore_event.h" />
|
||||||
<ClInclude Include="sttimer.h" />
|
<ClInclude Include="sttimer.h" />
|
||||||
<ClInclude Include="aspnetcore_msg.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="RequestHandler.rc" />
|
<ResourceCompile Include="RequestHandler.rc" />
|
||||||
|
|
@ -102,7 +100,4 @@
|
||||||
<UniqueIdentifier>{5568209f-269e-4d0a-bbb7-ba14f874ccb7}</UniqueIdentifier>
|
<UniqueIdentifier>{5568209f-269e-4d0a-bbb7-ba14f874ccb7}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<CustomBuild Include="aspnetcore_msg.mc" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
// Microsoft Visual C++ generated resource script.
|
|
||||||
//
|
|
||||||
#include "resource.h"
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
|
||||||
//
|
|
||||||
#include "winres.h"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// English (United States) resources
|
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
|
||||||
LANGUAGE 9, 1
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// TEXTINCLUDE
|
|
||||||
//
|
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"resource.h\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
2 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"#include ""winres.h""\r\n"
|
|
||||||
"\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"\r\n"
|
|
||||||
"\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
#endif // English (United States) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Version
|
|
||||||
//
|
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
|
||||||
FILEVERSION FileVersion
|
|
||||||
PRODUCTVERSION ProductVersion
|
|
||||||
FILEFLAGSMASK 0x3fL
|
|
||||||
#ifdef _DEBUG
|
|
||||||
FILEFLAGS 0x1L
|
|
||||||
#else
|
|
||||||
FILEFLAGS 0x0L
|
|
||||||
#endif
|
|
||||||
FILEOS 0x40004L
|
|
||||||
FILETYPE 0x2L
|
|
||||||
FILESUBTYPE 0x0L
|
|
||||||
BEGIN
|
|
||||||
BLOCK "StringFileInfo"
|
|
||||||
BEGIN
|
|
||||||
BLOCK "040904b0"
|
|
||||||
BEGIN
|
|
||||||
VALUE "CompanyName", "Microsoft"
|
|
||||||
VALUE "FileDescription", "IIS ASP.NET Core Module Request Handler"
|
|
||||||
VALUE "FileVersion", FileVersionStr
|
|
||||||
VALUE "InternalName", "aspnetcorerh.dll"
|
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2016"
|
|
||||||
VALUE "OriginalFilename", "aspnetcorerh.dll"
|
|
||||||
VALUE "ProductName", "ASP.NET Core Module"
|
|
||||||
VALUE "ProductVersion", ProductVersionStr
|
|
||||||
END
|
|
||||||
END
|
|
||||||
BLOCK "VarFileInfo"
|
|
||||||
BEGIN
|
|
||||||
VALUE "Translation", 0x409, 1200
|
|
||||||
END
|
|
||||||
END
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#endif // not APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
|
|
@ -1,165 +0,0 @@
|
||||||
/*++
|
|
||||||
|
|
||||||
Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
aspnetcore_msg.mc
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Asp.Net Core Module localizable messages.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _ASPNETCORE_MSG_H_
|
|
||||||
#define _ASPNETCORE_MSG_H_
|
|
||||||
|
|
||||||
//
|
|
||||||
// Values are 32 bit values laid out as follows:
|
|
||||||
//
|
|
||||||
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|
||||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|
||||||
// +---+-+-+-----------------------+-------------------------------+
|
|
||||||
// |Sev|C|R| Facility | Code |
|
|
||||||
// +---+-+-+-----------------------+-------------------------------+
|
|
||||||
//
|
|
||||||
// where
|
|
||||||
//
|
|
||||||
// Sev - is the severity code
|
|
||||||
//
|
|
||||||
// 00 - Success
|
|
||||||
// 01 - Informational
|
|
||||||
// 10 - Warning
|
|
||||||
// 11 - Error
|
|
||||||
//
|
|
||||||
// C - is the Customer code flag
|
|
||||||
//
|
|
||||||
// R - is a reserved bit
|
|
||||||
//
|
|
||||||
// Facility - is the facility code
|
|
||||||
//
|
|
||||||
// Code - is the facility's status code
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Define the facility codes
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Define the severity codes
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_PROCESS_START_ERROR
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_ERROR ((DWORD)0x000003E8L)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_PROCESS_START_SUCCESS
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_PROCESS_START_SUCCESS ((DWORD)0x000003E9L)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_PROCESS_CRASH
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_PROCESS_CRASH ((DWORD)0x000003EAL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED ((DWORD)0x000003EBL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_CONFIG_ERROR
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_CONFIG_ERROR ((DWORD)0x000003ECL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE ((DWORD)0x000003EDL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST ((DWORD)0x000003EEL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_LOAD_CLR_FALIURE
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_LOAD_CLR_FALIURE ((DWORD)0x000003EFL)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP ((DWORD)0x000003F0L)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR ((DWORD)0x000003F1L)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_ADD_APPLICATION_ERROR
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_ADD_APPLICATION_ERROR ((DWORD)0x000003F2L)
|
|
||||||
|
|
||||||
//
|
|
||||||
// MessageId: ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT
|
|
||||||
//
|
|
||||||
// MessageText:
|
|
||||||
//
|
|
||||||
// %1
|
|
||||||
//
|
|
||||||
#define ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT ((DWORD)0x000003F3L)
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _ASPNETCORE_MODULE_MSG_H_
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
LANGUAGE 0x9,0x1
|
|
||||||
1 11 "MSG00001.bin"
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
BOOL g_fNsiApiNotSupported = FALSE;
|
BOOL g_fNsiApiNotSupported = FALSE;
|
||||||
BOOL g_fWebSocketSupported = FALSE;
|
BOOL g_fWebSocketSupported = FALSE;
|
||||||
BOOL g_fEnableReferenceCountTracing = FALSE;
|
BOOL g_fEnableReferenceCountTracing = FALSE;
|
||||||
|
BOOL g_fGlobalInitialize = FALSE;
|
||||||
BOOL g_fOutOfProcessInitialize = FALSE;
|
BOOL g_fOutOfProcessInitialize = FALSE;
|
||||||
BOOL g_fOutOfProcessInitializeError = FALSE;
|
BOOL g_fOutOfProcessInitializeError = FALSE;
|
||||||
BOOL g_fWinHttpNonBlockingCallbackAvailable = FALSE;
|
BOOL g_fWinHttpNonBlockingCallbackAvailable = FALSE;
|
||||||
|
|
@ -17,87 +18,117 @@ SRWLOCK g_srwLockRH;
|
||||||
HINTERNET g_hWinhttpSession = NULL;
|
HINTERNET g_hWinhttpSession = NULL;
|
||||||
IHttpServer * g_pHttpServer = NULL;
|
IHttpServer * g_pHttpServer = NULL;
|
||||||
HINSTANCE g_hWinHttpModule;
|
HINSTANCE g_hWinHttpModule;
|
||||||
|
HANDLE g_hEventLog = NULL;
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
InitializeGlobalConfiguration(
|
InitializeGlobalConfiguration(
|
||||||
VOID
|
IHttpServer * pServer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
BOOL fLocked = FALSE;
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
||||||
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
|
||||||
0,
|
|
||||||
KEY_READ,
|
|
||||||
&hKey) == NO_ERROR)
|
|
||||||
{
|
|
||||||
DWORD dwType;
|
|
||||||
DWORD dwData;
|
|
||||||
DWORD cbData;
|
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"OptionalWinHttpFlags",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD))
|
|
||||||
{
|
|
||||||
g_OptionalWinHttpFlags = dwData;
|
|
||||||
}
|
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"EnableReferenceCountTracing",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD) && (dwData == 1 || dwData == 0))
|
|
||||||
{
|
|
||||||
g_fEnableReferenceCountTracing = !!dwData;
|
|
||||||
}
|
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"DebugFlags",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD))
|
|
||||||
{
|
|
||||||
g_dwAspNetCoreDebugFlags = dwData;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD dwSize = 0;
|
DWORD dwSize = 0;
|
||||||
DWORD dwResult = GetExtendedTcpTable(NULL,
|
DWORD dwResult = 0;
|
||||||
&dwSize,
|
|
||||||
FALSE,
|
if (!g_fGlobalInitialize)
|
||||||
AF_INET,
|
|
||||||
TCP_TABLE_OWNER_PID_LISTENER,
|
|
||||||
0);
|
|
||||||
if (dwResult != NO_ERROR && dwResult != ERROR_INSUFFICIENT_BUFFER)
|
|
||||||
{
|
{
|
||||||
g_fNsiApiNotSupported = TRUE;
|
AcquireSRWLockExclusive(&g_srwLockRH);
|
||||||
|
fLocked = TRUE;
|
||||||
|
|
||||||
|
if (g_fGlobalInitialize)
|
||||||
|
{
|
||||||
|
// Done by another thread
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pHttpServer = pServer;
|
||||||
|
if (pServer->IsCommandLineLaunch())
|
||||||
|
{
|
||||||
|
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_IISEXPRESS_EVENT_PROVIDER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_EVENT_PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&hKey) == NO_ERROR)
|
||||||
|
{
|
||||||
|
DWORD dwType;
|
||||||
|
DWORD dwData;
|
||||||
|
DWORD cbData;
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"OptionalWinHttpFlags",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD))
|
||||||
|
{
|
||||||
|
g_OptionalWinHttpFlags = dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"EnableReferenceCountTracing",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD) && (dwData == 1 || dwData == 0))
|
||||||
|
{
|
||||||
|
g_fEnableReferenceCountTracing = !!dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"DebugFlags",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD))
|
||||||
|
{
|
||||||
|
g_dwAspNetCoreDebugFlags = dwData;
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
dwResult = GetExtendedTcpTable(NULL,
|
||||||
|
&dwSize,
|
||||||
|
FALSE,
|
||||||
|
AF_INET,
|
||||||
|
TCP_TABLE_OWNER_PID_LISTENER,
|
||||||
|
0);
|
||||||
|
if (dwResult != NO_ERROR && dwResult != ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
{
|
||||||
|
g_fNsiApiNotSupported = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WebSocket is supported on Win8 and above only
|
||||||
|
// todo: test on win7
|
||||||
|
g_fWebSocketSupported = IsWindows8OrGreater();
|
||||||
|
|
||||||
|
g_fGlobalInitialize = TRUE;
|
||||||
|
}
|
||||||
|
Finished:
|
||||||
|
if (fLocked)
|
||||||
|
{
|
||||||
|
ReleaseSRWLockExclusive(&g_srwLockRH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebSocket is supported on Win8 and above only
|
|
||||||
// todo: test on win7
|
|
||||||
g_fWebSocketSupported = IsWindows8OrGreater();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global initialization routine for OutOfProcess
|
// Global initialization routine for OutOfProcess
|
||||||
//
|
//
|
||||||
HRESULT
|
HRESULT
|
||||||
EnsureOutOfProcessInitializtion( IHttpServer* pServer)
|
EnsureOutOfProcessInitializtion()
|
||||||
{
|
{
|
||||||
|
|
||||||
DBG_ASSERT(pServer);
|
DBG_ASSERT(pServer);
|
||||||
|
|
@ -105,13 +136,12 @@ EnsureOutOfProcessInitializtion( IHttpServer* pServer)
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
BOOL fLocked = FALSE;
|
BOOL fLocked = FALSE;
|
||||||
|
|
||||||
g_pHttpServer = pServer;
|
|
||||||
|
|
||||||
if (g_fOutOfProcessInitializeError)
|
if (g_fOutOfProcessInitializeError)
|
||||||
{
|
{
|
||||||
hr = E_NOT_VALID_STATE;
|
hr = E_NOT_VALID_STATE;
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_fOutOfProcessInitialize)
|
if (!g_fOutOfProcessInitialize)
|
||||||
{
|
{
|
||||||
AcquireSRWLockExclusive(&g_srwLockRH);
|
AcquireSRWLockExclusive(&g_srwLockRH);
|
||||||
|
|
@ -128,9 +158,6 @@ EnsureOutOfProcessInitializtion( IHttpServer* pServer)
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialze some global variables here
|
|
||||||
InitializeGlobalConfiguration();
|
|
||||||
|
|
||||||
g_hWinHttpModule = GetModuleHandle(TEXT("winhttp.dll"));
|
g_hWinHttpModule = GetModuleHandle(TEXT("winhttp.dll"));
|
||||||
|
|
||||||
hr = WINHTTP_HELPER::StaticInitialize();
|
hr = WINHTTP_HELPER::StaticInitialize();
|
||||||
|
|
@ -197,7 +224,6 @@ EnsureOutOfProcessInitializtion( IHttpServer* pServer)
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hr = FORWARDING_HANDLER::StaticInitialize(g_fEnableReferenceCountTracing);
|
hr = FORWARDING_HANDLER::StaticInitialize(g_fEnableReferenceCountTracing);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
@ -235,8 +261,6 @@ BOOL APIENTRY DllMain(HMODULE hModule,
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
DisableThreadLibraryCalls(hModule);
|
DisableThreadLibraryCalls(hModule);
|
||||||
InitializeSRWLock(&g_srwLockRH);
|
InitializeSRWLock(&g_srwLockRH);
|
||||||
// Initialze some global variables here
|
|
||||||
InitializeGlobalConfiguration();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -255,7 +279,8 @@ CreateApplication(
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
APPLICATION *pApplication = NULL;
|
APPLICATION *pApplication = NULL;
|
||||||
|
|
||||||
//REQUEST_HANDLER::StaticInitialize(pServer);
|
// Initialze some global variables here
|
||||||
|
InitializeGlobalConfiguration(pServer);
|
||||||
|
|
||||||
if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
||||||
{
|
{
|
||||||
|
|
@ -268,7 +293,7 @@ CreateApplication(
|
||||||
}
|
}
|
||||||
else if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_OUT_PROCESS)
|
else if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_OUT_PROCESS)
|
||||||
{
|
{
|
||||||
hr = EnsureOutOfProcessInitializtion(pServer);
|
hr = EnsureOutOfProcessInitializtion();
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
|
||||||
|
|
@ -343,33 +343,17 @@ Finished:
|
||||||
}
|
}
|
||||||
if (FAILED(hr) && m_pConfig->QueryStdoutLogEnabled())
|
if (FAILED(hr) && m_pConfig->QueryStdoutLogEnabled())
|
||||||
{
|
{
|
||||||
//todo log an warning
|
STRU strEventMsg;
|
||||||
//STRU strEventMsg;
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
//LPCWSTR apsz[1];
|
ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
|
||||||
|
m_struLogFilePath.QueryStr(),
|
||||||
//if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
hr)))
|
||||||
// ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
|
{
|
||||||
// m_struLogFilePath.QueryStr(),
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// HRESULT_FROM_GETLASTERROR())))
|
EVENTLOG_WARNING_TYPE,
|
||||||
//{
|
ASPNETCORE_EVENT_CONFIG_ERROR,
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
strEventMsg.QueryStr());
|
||||||
// //
|
}
|
||||||
// // not checking return code because if ReportEvent
|
|
||||||
// // fails, we cannot do anything.
|
|
||||||
// //
|
|
||||||
// if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
|
||||||
// {
|
|
||||||
// ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
|
||||||
// EVENTLOG_WARNING_TYPE,
|
|
||||||
// 0,
|
|
||||||
// ASPNETCORE_EVENT_CONFIG_ERROR,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// apsz,
|
|
||||||
// NULL);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,8 +368,6 @@ IN_PROCESS_APPLICATION::LoadManagedApplication
|
||||||
DWORD dwTimeout;
|
DWORD dwTimeout;
|
||||||
DWORD dwResult;
|
DWORD dwResult;
|
||||||
BOOL fLocked = FALSE;
|
BOOL fLocked = FALSE;
|
||||||
//PCWSTR apsz[1];
|
|
||||||
//STACK_STRU(strEventMsg, 256);
|
|
||||||
|
|
||||||
if (m_fManagedAppLoaded || m_fLoadManagedAppError)
|
if (m_fManagedAppLoaded || m_fLoadManagedAppError)
|
||||||
{
|
{
|
||||||
|
|
@ -481,36 +463,22 @@ Finished:
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
STACK_STRU(strEventMsg, 256);
|
||||||
// Question: in case of application loading failure, should we allow retry on
|
// Question: in case of application loading failure, should we allow retry on
|
||||||
// following request or block the activation at all
|
// following request or block the activation at all
|
||||||
m_fLoadManagedAppError = TRUE; // m_hThread != NULL ?
|
m_fLoadManagedAppError = TRUE; // m_hThread != NULL ?
|
||||||
|
|
||||||
// TODO
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
//if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
ASPNETCORE_EVENT_LOAD_CLR_FALIURE_MSG,
|
||||||
// ASPNETCORE_EVENT_LOAD_CLR_FALIURE_MSG,
|
m_pConfig->QueryApplicationPath()->QueryStr(),
|
||||||
// m_pConfiguration->QueryApplicationPath()->QueryStr(),
|
m_pConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||||
// m_pConfiguration->QueryApplicationPhysicalPath()->QueryStr(),
|
hr)))
|
||||||
// hr)))
|
{
|
||||||
//{
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
EVENTLOG_ERROR_TYPE,
|
||||||
|
ASPNETCORE_EVENT_LOAD_CLR_FALIURE,
|
||||||
// //
|
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_LOAD_CLR_FALIURE,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// apsz,
|
|
||||||
// NULL);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fLocked)
|
if (fLocked)
|
||||||
|
|
@ -583,37 +551,22 @@ Finished:
|
||||||
//
|
//
|
||||||
if (!m_fRecycleProcessCalled)
|
if (!m_fRecycleProcessCalled)
|
||||||
{
|
{
|
||||||
//STRU strEventMsg;
|
STRU strEventMsg;
|
||||||
//LPCWSTR apsz[1];
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
//if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT_MSG,
|
||||||
// ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT_MSG,
|
m_pConfig->QueryApplicationPath()->QueryStr(),
|
||||||
// m_pConfig->QueryApplicationPath()->QueryStr(),
|
m_pConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||||
// m_pConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
m_ProcessExitCode)))
|
||||||
// m_ProcessExitCode
|
{
|
||||||
//)))
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
//{
|
EVENTLOG_ERROR_TYPE,
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
// //
|
}
|
||||||
// // not checking return code because if ReportEvent
|
|
||||||
// // fails, we cannot do anything.
|
// error. the thread exits after application started
|
||||||
// //
|
// Question: should we shutdown current worker process or keep the application in failure state?
|
||||||
// if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
// for now, we reccylce to keep the same behavior as that of out-of-process
|
||||||
// {
|
|
||||||
// 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)
|
if (m_fManagedAppLoaded)
|
||||||
{
|
{
|
||||||
Recycle();
|
Recycle();
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ PROCESS_MANAGER::GetProcess(
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
BOOL fSharedLock = FALSE;
|
BOOL fSharedLock = FALSE;
|
||||||
BOOL fExclusiveLock = FALSE;
|
BOOL fExclusiveLock = FALSE;
|
||||||
//PCWSTR apsz[1];
|
|
||||||
STACK_STRU(strEventMsg, 256);
|
STACK_STRU(strEventMsg, 256);
|
||||||
DWORD dwProcessIndex = 0;
|
DWORD dwProcessIndex = 0;
|
||||||
SERVER_PROCESS *pSelectedServerProcess = NULL;
|
SERVER_PROCESS *pSelectedServerProcess = NULL;
|
||||||
|
|
@ -192,30 +191,15 @@ PROCESS_MANAGER::GetProcess(
|
||||||
//
|
//
|
||||||
// rapid fails per minute exceeded, do not create new process.
|
// rapid fails per minute exceeded, do not create new process.
|
||||||
//
|
//
|
||||||
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
//if( SUCCEEDED( strEventMsg.SafeSnwprintf(
|
ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG,
|
||||||
// ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG,
|
pConfig->QueryRapidFailsPerMinute())))
|
||||||
// pConfig->QueryRapidFailsPerMinute() ) ) )
|
{
|
||||||
//{
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED,
|
||||||
// //
|
strEventMsg.QueryStr());
|
||||||
// // not checking return code because if ReportEvent
|
}
|
||||||
// // fails, we cannot do anything.
|
|
||||||
// //
|
|
||||||
// if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
|
||||||
// {
|
|
||||||
// ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
|
||||||
// EVENTLOG_INFORMATION_TYPE,
|
|
||||||
// 0,
|
|
||||||
// ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// apsz,
|
|
||||||
// NULL);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
hr = HRESULT_FROM_WIN32(ERROR_SERVER_DISABLED);
|
hr = HRESULT_FROM_WIN32(ERROR_SERVER_DISABLED);
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
@ -293,4 +277,4 @@ Finished:
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -857,19 +857,12 @@ SERVER_PROCESS::StartProcess(
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
PROCESS_INFORMATION processInformation = {0};
|
PROCESS_INFORMATION processInformation = {0};
|
||||||
STARTUPINFOW startupInfo = {0};
|
STARTUPINFOW startupInfo = {0};
|
||||||
// BOOL fDonePrepareCommandLine = FALSE;
|
|
||||||
DWORD dwRetryCount = 2; // should we allow customer to config it
|
DWORD dwRetryCount = 2; // should we allow customer to config it
|
||||||
DWORD dwCreationFlags = 0;
|
DWORD dwCreationFlags = 0;
|
||||||
|
STACK_STRU( strEventMsg, 256);
|
||||||
// STACK_STRU( strEventMsg, 256);
|
|
||||||
// STRU strFullProcessPath;
|
|
||||||
// STRU struRelativePath;
|
|
||||||
// STRU struApplicationId;
|
|
||||||
//
|
|
||||||
// LPCWSTR apsz[1];
|
|
||||||
MULTISZ mszNewEnvironment;
|
MULTISZ mszNewEnvironment;
|
||||||
ENVIRONMENT_VAR_HASH *pHashTable = NULL;
|
ENVIRONMENT_VAR_HASH *pHashTable = NULL;
|
||||||
//
|
|
||||||
GetStartupInfoW(&startupInfo);
|
GetStartupInfoW(&startupInfo);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -945,13 +938,13 @@ SERVER_PROCESS::StartProcess(
|
||||||
{
|
{
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
// don't the check return code as we already in error report
|
// don't the check return code as we already in error report
|
||||||
/*strEventMsg.SafeSnwprintf(
|
strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG,
|
ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG,
|
||||||
m_struAppFullPath.QueryStr(),
|
m_struAppFullPath.QueryStr(),
|
||||||
m_pszRootApplicationPath.QueryStr(),
|
m_struPhysicalPath.QueryStr(),
|
||||||
struCommandLine.QueryStr(),
|
m_struCommandLine.QueryStr(),
|
||||||
hr,
|
hr,
|
||||||
0);*/
|
dwRetryCount);
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -987,42 +980,17 @@ SERVER_PROCESS::StartProcess(
|
||||||
// Backend process starts successfully. Set retry counter to 0
|
// Backend process starts successfully. Set retry counter to 0
|
||||||
dwRetryCount = 0;
|
dwRetryCount = 0;
|
||||||
|
|
||||||
//
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
// if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG,
|
||||||
// ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG,
|
m_struAppFullPath.QueryStr(),
|
||||||
// m_struAppFullPath.QueryStr(),
|
m_dwProcessId,
|
||||||
// m_dwProcessId,
|
m_dwPort)))
|
||||||
// m_dwPort)))
|
{
|
||||||
// {
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
//
|
ASPNETCORE_EVENT_PROCESS_START_SUCCESS,
|
||||||
// //
|
strEventMsg.QueryStr());
|
||||||
// // not checking return code because if ReportEvent
|
}
|
||||||
// // fails, we cannot do anything.
|
|
||||||
// //
|
|
||||||
// if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
|
||||||
// {
|
|
||||||
// ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
|
||||||
// EVENTLOG_INFORMATION_TYPE,
|
|
||||||
// 0,
|
|
||||||
// ASPNETCORE_EVENT_PROCESS_START_SUCCESS,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// 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:
|
Finished:
|
||||||
if (processInformation.hThread != NULL)
|
if (processInformation.hThread != NULL)
|
||||||
|
|
@ -1037,57 +1005,29 @@ SERVER_PROCESS::StartProcess(
|
||||||
delete pHashTable;
|
delete pHashTable;
|
||||||
pHashTable = NULL;
|
pHashTable = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
// {
|
{
|
||||||
// if (strEventMsg.IsEmpty())
|
if (strEventMsg.IsEmpty())
|
||||||
// {
|
{
|
||||||
// if (!fDonePrepareCommandLine)
|
strEventMsg.SafeSnwprintf(
|
||||||
// {
|
ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG,
|
||||||
// strEventMsg.SafeSnwprintf(
|
m_struAppFullPath.QueryStr(),
|
||||||
// m_struAppFullPath.QueryStr(),
|
m_struPhysicalPath.QueryStr(),
|
||||||
// ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG,
|
m_struCommandLine.QueryStr(),
|
||||||
// hr);
|
hr,
|
||||||
// }
|
dwRetryCount);
|
||||||
// else
|
}
|
||||||
// {
|
|
||||||
// strEventMsg.SafeSnwprintf(
|
if (!strEventMsg.IsEmpty())
|
||||||
// ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG,
|
{
|
||||||
// m_struAppFullPath.QueryStr(),
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// m_pszRootApplicationPath.QueryStr(),
|
EVENTLOG_ERROR_TYPE,
|
||||||
// struCommandLine.QueryStr(),
|
ASPNETCORE_EVENT_PROCESS_START_ERROR,
|
||||||
// hr);
|
strEventMsg.QueryStr());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// 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_PROCESS_START_ERROR,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// 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)
|
if (FAILED(hr) || m_fReady == FALSE)
|
||||||
{
|
{
|
||||||
|
|
@ -1121,7 +1061,6 @@ SERVER_PROCESS::StartProcess(
|
||||||
}
|
}
|
||||||
|
|
||||||
StopProcess();
|
StopProcess();
|
||||||
|
|
||||||
StopAllProcessesInJobObject();
|
StopAllProcessesInJobObject();
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
|
|
@ -1165,8 +1104,6 @@ SERVER_PROCESS::SetupStdHandles(
|
||||||
SECURITY_ATTRIBUTES saAttr = { 0 };
|
SECURITY_ATTRIBUTES saAttr = { 0 };
|
||||||
|
|
||||||
STRU struPath;
|
STRU struPath;
|
||||||
//STRU strEventMsg;
|
|
||||||
//LPCWSTR apsz[1];
|
|
||||||
|
|
||||||
DBG_ASSERT(pStartupInfo);
|
DBG_ASSERT(pStartupInfo);
|
||||||
|
|
||||||
|
|
@ -1258,30 +1195,17 @@ Finished:
|
||||||
if (m_fStdoutLogEnabled)
|
if (m_fStdoutLogEnabled)
|
||||||
{
|
{
|
||||||
// Log the error
|
// Log the error
|
||||||
//if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
STRU strEventMsg;
|
||||||
// ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
// m_struFullLogFile.QueryStr(),
|
ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG,
|
||||||
// HRESULT_FROM_GETLASTERROR())))
|
m_struFullLogFile.QueryStr(),
|
||||||
//{
|
hr)))
|
||||||
// apsz[0] = strEventMsg.QueryStr();
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
// //
|
EVENTLOG_WARNING_TYPE,
|
||||||
// // not checking return code because if ReportEvent
|
ASPNETCORE_EVENT_CONFIG_ERROR,
|
||||||
// // fails, we cannot do anything.
|
strEventMsg.QueryStr());
|
||||||
// //
|
}
|
||||||
// /*if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
|
||||||
// {
|
|
||||||
// ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
|
||||||
// EVENTLOG_WARNING_TYPE,
|
|
||||||
// 0,
|
|
||||||
// ASPNETCORE_EVENT_CONFIG_ERROR,
|
|
||||||
// NULL,
|
|
||||||
// 1,
|
|
||||||
// 0,
|
|
||||||
// apsz,
|
|
||||||
// NULL);
|
|
||||||
// }*/
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
|
|
@ -2077,9 +2001,7 @@ SERVER_PROCESS::SendShutdownHttpMessage( VOID )
|
||||||
STRU strUrl;
|
STRU strUrl;
|
||||||
DWORD dwStatusCode = 0;
|
DWORD dwStatusCode = 0;
|
||||||
DWORD dwSize = sizeof(dwStatusCode);
|
DWORD dwSize = sizeof(dwStatusCode);
|
||||||
|
STACK_STRU(strEventMsg, 256);
|
||||||
//LPCWSTR apsz[1];
|
|
||||||
//STACK_STRU(strEventMsg, 256);
|
|
||||||
|
|
||||||
hSession = WinHttpOpen(L"",
|
hSession = WinHttpOpen(L"",
|
||||||
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
|
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
|
||||||
|
|
@ -2182,25 +2104,16 @@ SERVER_PROCESS::SendShutdownHttpMessage( VOID )
|
||||||
}
|
}
|
||||||
|
|
||||||
// log
|
// log
|
||||||
/*if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST_MSG,
|
ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST_MSG,
|
||||||
m_dwProcessId,
|
m_dwProcessId,
|
||||||
dwStatusCode)))
|
dwStatusCode)))
|
||||||
{
|
{
|
||||||
apsz[0] = strEventMsg.QueryStr();
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
{
|
ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST,
|
||||||
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
strEventMsg.QueryStr());
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
}
|
||||||
0,
|
|
||||||
ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST,
|
|
||||||
NULL,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
apsz,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Finished:
|
Finished:
|
||||||
if (hRequest)
|
if (hRequest)
|
||||||
|
|
@ -2291,8 +2204,7 @@ SERVER_PROCESS::TerminateBackendProcess(
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//LPCWSTR apsz[1];
|
STACK_STRU(strEventMsg, 256);
|
||||||
//STACK_STRU(strEventMsg, 256);
|
|
||||||
|
|
||||||
if (InterlockedCompareExchange(&m_lStopping, 1L, 0L) == 0L)
|
if (InterlockedCompareExchange(&m_lStopping, 1L, 0L) == 0L)
|
||||||
{
|
{
|
||||||
|
|
@ -2316,23 +2228,14 @@ SERVER_PROCESS::TerminateBackendProcess(
|
||||||
}
|
}
|
||||||
|
|
||||||
// log a warning for ungraceful shutdown
|
// log a warning for ungraceful shutdown
|
||||||
/*if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE_MSG,
|
ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE_MSG,
|
||||||
m_dwProcessId)))
|
m_dwProcessId)))
|
||||||
{
|
{
|
||||||
apsz[0] = strEventMsg.QueryStr();
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
EVENTLOG_WARNING_TYPE,
|
||||||
{
|
ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE,
|
||||||
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
strEventMsg.QueryStr());
|
||||||
EVENTLOG_WARNING_TYPE,
|
}
|
||||||
0,
|
|
||||||
ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE,
|
|
||||||
NULL,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
apsz,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@
|
||||||
#include "..\CommonLib\aspnetcoreconfig.h"
|
#include "..\CommonLib\aspnetcoreconfig.h"
|
||||||
#include "..\CommonLib\utility.h"
|
#include "..\CommonLib\utility.h"
|
||||||
#include "..\CommonLib\application.h"
|
#include "..\CommonLib\application.h"
|
||||||
|
#include "..\CommonLib\resources.h"
|
||||||
#include "aspnetcore_event.h"
|
#include "aspnetcore_event.h"
|
||||||
#include "aspnetcore_msg.h"
|
#include "aspnetcore_msg.h"
|
||||||
#include "disconnectcontext.h"
|
#include "disconnectcontext.h"
|
||||||
#include "sttimer.h"
|
#include "sttimer.h"
|
||||||
#include "resource.h"
|
|
||||||
#include ".\inprocess\InProcessHandler.h"
|
#include ".\inprocess\InProcessHandler.h"
|
||||||
#include ".\inprocess\inprocessapplication.h"
|
#include ".\inprocess\inprocessapplication.h"
|
||||||
#include ".\outofprocess\responseheaderhash.h"
|
#include ".\outofprocess\responseheaderhash.h"
|
||||||
|
|
@ -88,8 +88,6 @@ template<typename T> inline T min(T a, T b)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ASPNETCORE_EVENT_PROVIDER L"IIS AspNetCore Module"
|
|
||||||
#define ASPNETCORE_IISEXPRESS_EVENT_PROVIDER L"IIS Express AspNetCore Module"
|
|
||||||
|
|
||||||
inline bool IsSpace(char ch)
|
inline bool IsSpace(char ch)
|
||||||
{
|
{
|
||||||
|
|
@ -117,3 +115,4 @@ extern DWORD g_OptionalWinHttpFlags;
|
||||||
extern SRWLOCK g_srwLockRH;
|
extern SRWLOCK g_srwLockRH;
|
||||||
extern HINTERNET g_hWinhttpSession;
|
extern HINTERNET g_hWinhttpSession;
|
||||||
extern DWORD g_dwTlsIndex;
|
extern DWORD g_dwTlsIndex;
|
||||||
|
extern HANDLE g_hEventLog;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue