diff --git a/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.cpp b/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.cpp
index 9f9ec1e75c..f7b77c92fc 100644
--- a/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.cpp
+++ b/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.cpp
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "stdafx.h"
-
+#include "sttimer.h"
FileOutputManager::FileOutputManager()
: m_pStdOutFile(NULL)
diff --git a/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.h b/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.h
index c4f087161c..11fb662c67 100644
--- a/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.h
+++ b/src/AspNetCoreModuleV2/CommonLib/FileOutputManager.h
@@ -3,6 +3,7 @@
#pragma once
+#include "sttimer.h"
class FileOutputManager : public IOutputManager
{
diff --git a/src/AspNetCoreModuleV2/CommonLib/LoggingHelpers.cpp b/src/AspNetCoreModuleV2/CommonLib/LoggingHelpers.cpp
index dbb6f71474..2af111253e 100644
--- a/src/AspNetCoreModuleV2/CommonLib/LoggingHelpers.cpp
+++ b/src/AspNetCoreModuleV2/CommonLib/LoggingHelpers.cpp
@@ -16,19 +16,26 @@ LoggingHelpers::CreateLoggingProvider(
DBG_ASSERT(outputManager != NULL);
- if (fIsLoggingEnabled)
+ try
{
- FileOutputManager* manager = new FileOutputManager;
- hr = manager->Initialize(pwzStdOutFileName, pwzApplicationPath);
- *outputManager = manager;
+ if (fIsLoggingEnabled)
+ {
+ FileOutputManager* manager = new FileOutputManager;
+ hr = manager->Initialize(pwzStdOutFileName, pwzApplicationPath);
+ *outputManager = manager;
+ }
+ else if (fEnablePipe)
+ {
+ *outputManager = new PipeOutputManager;
+ }
+ else
+ {
+ *outputManager = new NullOutputManager;
+ }
}
- else if (fEnablePipe)
+ catch (std::bad_alloc&)
{
- *outputManager = new PipeOutputManager;
- }
- else
- {
- *outputManager = new NullOutputManager;
+ hr = E_OUTOFMEMORY;
}
return hr;
diff --git a/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.cpp b/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.cpp
index a341445fc6..9a9a5cdd46 100644
--- a/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.cpp
+++ b/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.cpp
@@ -33,35 +33,42 @@ REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(
STRU struHostFxrDllLocation;
STRU struExeLocation;
- if (ppAspNetCoreConfig == NULL)
+ try
{
- hr = E_INVALIDARG;
- goto Finished;
+ if (ppAspNetCoreConfig == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto Finished;
+ }
+
+ *ppAspNetCoreConfig = NULL;
+
+ pRequestHandlerConfig = new REQUESTHANDLER_CONFIG;
+
+ hr = pRequestHandlerConfig->Populate(pHttpServer, pHttpApplication);
+ if (FAILED(hr))
+ {
+ goto Finished;
+ }
+
+ DebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO,
+ "REQUESTHANDLER_CONFIG::GetConfig, set config to ModuleContext");
+ // set appliction info here instead of inside Populate()
+ // as the destructor will delete the backend process
+ hr = pRequestHandlerConfig->QueryApplicationPath()->Copy(pHttpApplication->GetApplicationId());
+ if (FAILED(hr))
+ {
+ goto Finished;
+ }
+
+ *ppAspNetCoreConfig = pRequestHandlerConfig;
+ pRequestHandlerConfig = NULL;
}
-
- *ppAspNetCoreConfig = NULL;
-
- pRequestHandlerConfig = new REQUESTHANDLER_CONFIG;
-
- hr = pRequestHandlerConfig->Populate(pHttpServer, pHttpApplication);
- if (FAILED(hr))
+ catch (std::bad_alloc&)
{
- goto Finished;
+ hr = E_OUTOFMEMORY;
}
- DebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO,
- "REQUESTHANDLER_CONFIG::GetConfig, set config to ModuleContext");
- // set appliction info here instead of inside Populate()
- // as the destructor will delete the backend process
- hr = pRequestHandlerConfig->QueryApplicationPath()->Copy(pHttpApplication->GetApplicationId());
- if (FAILED(hr))
- {
- goto Finished;
- }
-
- *ppAspNetCoreConfig = pRequestHandlerConfig;
- pRequestHandlerConfig = NULL;
-
Finished:
if (pRequestHandlerConfig != NULL)
diff --git a/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.h b/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.h
index d9c368468a..71f5cb6e66 100644
--- a/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.h
+++ b/src/AspNetCoreModuleV2/CommonLib/requesthandler_config.h
@@ -209,10 +209,10 @@ public:
return &m_struConfigPath;
}
-private:
+protected:
//
- // private constructor
+ // protected constructor
//
REQUESTHANDLER_CONFIG() :
m_fStdoutLogEnabled(FALSE),
diff --git a/src/AspNetCoreModuleV2/CommonLib/stdafx.h b/src/AspNetCoreModuleV2/CommonLib/stdafx.h
index 8e5563da25..969590ea6e 100644
--- a/src/AspNetCoreModuleV2/CommonLib/stdafx.h
+++ b/src/AspNetCoreModuleV2/CommonLib/stdafx.h
@@ -23,6 +23,7 @@
#include "dbgutil.h"
#include "ahutil.h"
#include "hashfn.h"
+#include "sttimer.h"
#include "irequesthandler.h"
#include "sttimer.h"
#include "requesthandler.h"
diff --git a/src/AspNetCoreModuleV2/CommonLib/sttimer.h b/src/AspNetCoreModuleV2/CommonLib/sttimer.h
index dfb79e7a6a..ada44158a7 100644
--- a/src/AspNetCoreModuleV2/CommonLib/sttimer.h
+++ b/src/AspNetCoreModuleV2/CommonLib/sttimer.h
@@ -3,6 +3,8 @@
#pragma once
+#include "stdafx.h"
+
#ifndef _STTIMER_H
#define _STTIMER_H
@@ -276,4 +278,4 @@ private:
BOOL _fUsingHighResolution;
};
-#endif // _STTIMER_H
\ No newline at end of file
+#endif // _STTIMER_H
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj b/src/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj
index db22833452..4d7de9cf3a 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj
@@ -211,16 +211,14 @@
-
-
+
+
-
-
-
-
+
+
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/dllmain.cxx b/src/AspNetCoreModuleV2/InProcessRequestHandler/dllmain.cxx
index 00002cd023..ac020d6369 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/dllmain.cxx
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/dllmain.cxx
@@ -1,8 +1,16 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
// dllmain.cpp : Defines the entry point for the DLL application.
+
#include "precomp.hxx"
#include
#include
+#include "inprocessapplication.h"
+#include "inprocesshandler.h"
+#include "requesthandler_config.h"
+
BOOL g_fGlobalInitialize = FALSE;
BOOL g_fProcessDetach = FALSE;
DWORD g_dwAspNetCoreDebugFlags = 0;
@@ -103,31 +111,56 @@ __stdcall
CreateApplication(
_In_ IHttpServer *pServer,
_In_ IHttpContext *pHttpContext,
- _In_ PCWSTR pwzExeLocation,
+ _In_ PCWSTR pwzExeLocation,
_Out_ IAPPLICATION **ppApplication
)
{
- HRESULT hr = S_OK;
- IAPPLICATION *pApplication = NULL;
- REQUESTHANDLER_CONFIG *pConfig;
+ HRESULT hr = S_OK;
+ IN_PROCESS_APPLICATION *pApplication = NULL;
+ REQUESTHANDLER_CONFIG *pConfig = NULL;
+
// Initialze some global variables here
InitializeGlobalConfiguration(pServer);
- hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), &pConfig);
- if (FAILED(hr))
+ try
{
- return hr;
- }
+ hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), &pConfig);
+ if (FAILED(hr))
+ {
+ goto Finished;
+ }
- pApplication = new IN_PROCESS_APPLICATION(pServer, pConfig, pwzExeLocation);
- if (pApplication == NULL)
+ pApplication = new IN_PROCESS_APPLICATION(pServer, pConfig);
+
+ pConfig = NULL;
+
+ hr = pApplication->Initialize(pwzExeLocation);
+ if (FAILED(hr))
+ {
+ goto Finished;
+ }
+
+ *ppApplication = pApplication;
+ }
+ catch (std::bad_alloc&)
{
- hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
- goto Finished;
+ hr = E_OUTOFMEMORY;
}
- *ppApplication = pApplication;
-
Finished:
+ if (FAILED(hr))
+ {
+ if (pApplication != NULL)
+ {
+ delete pApplication;
+ pApplication = NULL;
+ }
+ if (pConfig != NULL)
+ {
+ delete pConfig;
+ pConfig = NULL;
+ }
+ }
+
return hr;
}
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.cpp b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp
similarity index 97%
rename from src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.cpp
rename to src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp
index 81ec85fab3..44ea05ab3c 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.cpp
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp
@@ -1,21 +1,26 @@
-#include "..\precomp.hxx"
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+#include "inprocessapplication.h"
+#include "inprocesshandler.h"
#include "hostfxroptions.h"
+#include "requesthandler_config.h"
+#include "environmentvariablehelpers.h"
+#include "aspnetcore_event.h"
IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL;
hostfxr_main_fn IN_PROCESS_APPLICATION::s_fMainCallback = NULL;
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
IHttpServer *pHttpServer,
- REQUESTHANDLER_CONFIG *pConfig,
- PCWSTR pDotnetExeLocation) :
+ REQUESTHANDLER_CONFIG *pConfig) :
m_pHttpServer(pHttpServer),
m_ProcessExitCode(0),
m_fBlockCallbacksIntoManaged(FALSE),
m_fInitialized(FALSE),
m_fShutdownCalledFromNative(FALSE),
m_fShutdownCalledFromManaged(FALSE),
- m_srwLock(),
- m_pstrDotnetExeLocation(pDotnetExeLocation)
+ m_srwLock()
{
// is it guaranteed that we have already checked app offline at this point?
// If so, I don't think there is much to do here.
@@ -24,10 +29,18 @@ IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
InitializeSRWLock(&m_srwLock);
m_pConfig = pConfig;
- // TODO we can probably initialized as I believe we are the only ones calling recycle.
+
m_status = APPLICATION_STATUS::STARTING;
}
+HRESULT
+IN_PROCESS_APPLICATION::Initialize(
+ PCWSTR pDotnetExeLocation
+)
+{
+ return m_struExeLocation.Copy(pDotnetExeLocation);
+}
+
IN_PROCESS_APPLICATION::~IN_PROCESS_APPLICATION()
{
@@ -573,7 +586,7 @@ IN_PROCESS_APPLICATION::ExecuteApplication(
}
if (FAILED(hr = HOSTFXR_OPTIONS::Create(
- m_pstrDotnetExeLocation,
+ m_struExeLocation.QueryStr(),
m_pConfig->QueryProcessPath()->QueryStr(),
m_pConfig->QueryApplicationPhysicalPath()->QueryStr(),
m_pConfig->QueryArguments()->QueryStr(),
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.h b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.h
similarity index 96%
rename from src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.h
rename to src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.h
index c9d0285369..4641cd67b1 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocessapplication.h
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.h
@@ -2,6 +2,11 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
+
+#include "precomp.hxx"
+#include "inprocesshandler.h"
+#include "requesthandler_config.h"
+
typedef INT(*hostfxr_main_fn) (CONST DWORD argc, CONST PCWSTR argv[]); // TODO these may need to be BSTRs
typedef REQUEST_NOTIFICATION_STATUS(WINAPI * PFN_REQUEST_HANDLER) (IN_PROCESS_HANDLER* pInProcessHandler, void* pvRequestHandlerContext);
@@ -13,14 +18,13 @@ class IN_PROCESS_APPLICATION : public APPLICATION
public:
IN_PROCESS_APPLICATION(
IHttpServer* pHttpServer,
- REQUESTHANDLER_CONFIG *pConfig,
- PCWSTR pDotnetExeLocation);
+ REQUESTHANDLER_CONFIG *pConfig);
~IN_PROCESS_APPLICATION();
HRESULT
Initialize(
- VOID
+ PCWSTR pDotnetExeLocation
);
__override
@@ -156,7 +160,6 @@ private:
HANDLE m_hErrThread;
CHAR m_pzFileContents[4096] = { 0 };
DWORD m_dwStdErrReadTotal;
- PCWSTR m_pstrDotnetExeLocation;
static IN_PROCESS_APPLICATION* s_Application;
IOutputManager* m_pLoggerProvider;
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.cpp b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.cpp
similarity index 92%
rename from src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.cpp
rename to src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.cpp
index 82e3328388..5678e2c4fd 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.cpp
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.cpp
@@ -1,4 +1,9 @@
-#include "..\precomp.hxx"
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+#include "inprocesshandler.h"
+#include "inprocessapplication.h"
+#include "aspnetcore_event.h"
IN_PROCESS_HANDLER::IN_PROCESS_HANDLER(
_In_ IHttpContext *pW3Context,
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.h b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.h
similarity index 87%
rename from src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.h
rename to src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.h
index 5fbaa96940..256b355ce5 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocess/inprocesshandler.h
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocesshandler.h
@@ -1,12 +1,17 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
#pragma once
+#include "precomp.hxx"
+#include "requesthandler.h"
+
class IN_PROCESS_APPLICATION;
class IN_PROCESS_HANDLER : public REQUEST_HANDLER
{
public:
IN_PROCESS_HANDLER(
-
_In_ IHttpContext *pW3Context,
_In_ IN_PROCESS_APPLICATION *pApplication);
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/managedexports.cxx b/src/AspNetCoreModuleV2/InProcessRequestHandler/managedexports.cxx
index c548d6b85f..3c82bd850a 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/managedexports.cxx
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/managedexports.cxx
@@ -2,7 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "precomp.hxx"
-
+#include "inprocessapplication.h"
+#include "inprocesshandler.h"
+#include "requesthandler_config.h"
//
// Initialization export
//
diff --git a/src/AspNetCoreModuleV2/InProcessRequestHandler/precomp.hxx b/src/AspNetCoreModuleV2/InProcessRequestHandler/precomp.hxx
index 2a2c5812e7..6c4cd3bdad 100644
--- a/src/AspNetCoreModuleV2/InProcessRequestHandler/precomp.hxx
+++ b/src/AspNetCoreModuleV2/InProcessRequestHandler/precomp.hxx
@@ -44,26 +44,6 @@
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
-#include "..\IISLib\acache.h"
-#include "..\IISLib\multisz.h"
-#include "..\IISLib\multisza.h"
-#include "..\IISLib\base64.h"
-#include "..\IISLib\listentry.h"
-#include "..\CommonLib\fx_ver.h"
-#include "..\CommonLib\debugutil.h"
-#include "..\CommonLib\requesthandler.h"
-#include "..\CommonLib\requesthandler_config.h"
-#include "..\CommonLib\utility.h"
-#include "..\CommonLib\application.h"
-#include "..\CommonLib\resources.h"
-#include "aspnetcore_event.h"
-#include "aspnetcore_msg.h"
-#include "disconnectcontext.h"
-#include "environmentvariablehelpers.h"
-#include "sttimer.h"
-#include ".\inprocess\InProcessHandler.h"
-#include ".\inprocess\inprocessapplication.h"
-
#ifdef max
#undef max
template inline T max(T a, T b)
diff --git a/test/CommonLibTests/CommonLibTests.vcxproj b/test/CommonLibTests/CommonLibTests.vcxproj
index 5e30180286..33756b7bd0 100644
--- a/test/CommonLibTests/CommonLibTests.vcxproj
+++ b/test/CommonLibTests/CommonLibTests.vcxproj
@@ -46,12 +46,14 @@
+
+
@@ -75,6 +77,9 @@
{cac1267b-8778-4257-aac6-caf481723b01}
+
+ {d57ea297-6dc2-4bc0-8c91-334863327863}
+
@@ -88,13 +93,15 @@
EnableFastChecks
MultiThreadedDebug
Level3
- $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;..\..\src\AspNetCoreModuleV2\AspNetCore\Inc;
+ $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;...\..\src\AspNetCoreModuleV2\AspNetCore\Inc;..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\;
/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
stdcpp17
true
Console
+ ..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\$(Configuration)\;
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)
@@ -111,13 +118,15 @@
EnableFastChecks
MultiThreadedDebug
Level3
- $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;..\..\src\AspNetCoreModuleV2\AspNetCore\Inc;
+ $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;...\..\src\AspNetCoreModuleV2\AspNetCore\Inc;..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\;
/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
stdcpp17
true
Console
+ ..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\x64\$(Configuration)\;
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)
@@ -132,7 +141,7 @@
MultiThreaded
Level3
ProgramDatabase
- $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;..\..\src\AspNetCoreModuleV2\AspNetCore\Inc;
+ $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;...\..\src\AspNetCoreModuleV2\AspNetCore\Inc;..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\;
/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
stdcpp17
@@ -141,6 +150,8 @@
Console
true
true
+ ..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\$(Configuration)\;
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)
@@ -155,7 +166,7 @@
MultiThreaded
Level3
ProgramDatabase
- $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;..\..\src\AspNetCoreModuleV2\AspNetCore\Inc;
+ $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\..\src\AspNetCoreModuleV2\IISLib;..\..\src\AspNetCoreModuleV2\CommonLib;..\gtest\googletest\googletest\include;...\..\src\AspNetCoreModuleV2\AspNetCore\Inc;..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\;
/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
stdcpp14
@@ -164,6 +175,8 @@
Console
true
true
+ ..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\x64\$(Configuration)\;
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)
diff --git a/test/CommonLibTests/fakeclasses.h b/test/CommonLibTests/fakeclasses.h
new file mode 100644
index 0000000000..5f79138879
--- /dev/null
+++ b/test/CommonLibTests/fakeclasses.h
@@ -0,0 +1,131 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+#include "stdafx.h"
+
+class MockHttpServer : public IHttpServer
+{
+ // Inherited via IHttpServer
+ virtual BOOL IsCommandLineLaunch(VOID) const override
+ {
+ return 0;
+ }
+ virtual PCWSTR GetAppPoolName(VOID) const override
+ {
+ return PCWSTR();
+ }
+ virtual HRESULT AssociateWithThreadPool(HANDLE hHandle, LPOVERLAPPED_COMPLETION_ROUTINE completionRoutine) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual VOID IncrementThreadCount(VOID) override
+ {
+ return VOID();
+ }
+ virtual VOID DecrementThreadCount(VOID) override
+ {
+ return VOID();
+ }
+ virtual VOID ReportUnhealthy(PCWSTR pszReasonString, HRESULT hrReason) override
+ {
+ return VOID();
+ }
+ virtual VOID RecycleProcess(PCWSTR pszReason) override
+ {
+ return VOID();
+ }
+ virtual IAppHostAdminManager * GetAdminManager(VOID) const override
+ {
+ return nullptr;
+ }
+ virtual HRESULT GetFileInfo(PCWSTR pszPhysicalPath, HANDLE hUserToken, PSID pSid, PCWSTR pszChangeNotificationPath, HANDLE hChangeNotificationToken, BOOL fCache, IHttpFileInfo ** ppFileInfo, IHttpTraceContext * pHttpTraceContext = NULL) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT FlushKernelCache(PCWSTR pszUrl) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT DoCacheOperation(CACHE_OPERATION cacheOperation, IHttpCacheKey * pCacheKey, IHttpCacheSpecificData ** ppCacheSpecificData, IHttpTraceContext * pHttpTraceContext = NULL) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual GLOBAL_NOTIFICATION_STATUS NotifyCustomNotification(ICustomNotificationProvider * pCustomOutput) override
+ {
+ return GLOBAL_NOTIFICATION_STATUS();
+ }
+ virtual IHttpPerfCounterInfo * GetPerfCounterInfo(VOID) override
+ {
+ return nullptr;
+ }
+ virtual VOID RecycleApplication(PCWSTR pszAppConfigPath) override
+ {
+ return VOID();
+ }
+ virtual VOID NotifyConfigurationChange(PCWSTR pszPath) override
+ {
+ return VOID();
+ }
+ virtual VOID NotifyFileChange(PCWSTR pszFileName) override
+ {
+ return VOID();
+ }
+ virtual IDispensedHttpModuleContextContainer * DispenseContainer(VOID) override
+ {
+ return nullptr;
+ }
+ virtual HRESULT AddFragmentToCache(HTTP_DATA_CHUNK * pDataChunk, PCWSTR pszFragmentName) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT ReadFragmentFromCache(PCWSTR pszFragmentName, BYTE * pvBuffer, DWORD cbSize, DWORD * pcbCopied) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT RemoveFragmentFromCache(PCWSTR pszFragmentName) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT GetWorkerProcessSettings(IWpfSettings ** ppWorkerProcessSettings) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT GetProtocolManagerCustomInterface(PCWSTR pProtocolManagerDll, PCWSTR pProtocolManagerDllInitFunction, DWORD dwCustomInterfaceId, PVOID * ppCustomInterface) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual BOOL SatisfiesPrecondition(PCWSTR pszPrecondition, BOOL * pfUnknownPrecondition = NULL) const override
+ {
+ return 0;
+ }
+ virtual IHttpTraceContext * GetTraceContext(VOID) const override
+ {
+ return nullptr;
+ }
+ virtual HRESULT RegisterFileChangeMonitor(PCWSTR pszPath, HANDLE hToken, IHttpFileMonitor ** ppFileMonitor) override
+ {
+ return E_NOTIMPL;
+ }
+ virtual HRESULT GetExtendedInterface(HTTP_SERVER_INTERFACE_VERSION version, PVOID * ppInterface) override
+ {
+ return E_NOTIMPL;
+ }
+};
+
+class MockRequestHandlerConfig : public REQUESTHANDLER_CONFIG
+{
+public:
+ static
+ MockRequestHandlerConfig*
+ CreateConfig()
+ {
+ return new MockRequestHandlerConfig;
+ }
+
+private:
+ MockRequestHandlerConfig()
+ {
+
+ }
+};
+
diff --git a/test/CommonLibTests/inprocess_application_tests.cpp b/test/CommonLibTests/inprocess_application_tests.cpp
new file mode 100644
index 0000000000..42ca949749
--- /dev/null
+++ b/test/CommonLibTests/inprocess_application_tests.cpp
@@ -0,0 +1,23 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+#include "stdafx.h"
+#include "inprocessapplication.h"
+#include "fakeclasses.h"
+
+namespace InprocessTests
+{
+ TEST(InProcessTest, NoNullRefForExePath)
+ {
+ auto server = new MockHttpServer();
+ auto requestHandlerConfig = MockRequestHandlerConfig::CreateConfig();
+ IN_PROCESS_APPLICATION *app = new IN_PROCESS_APPLICATION(server, requestHandlerConfig);
+ {
+ std::wstring exePath(L"hello");
+ app->Initialize(exePath.c_str());
+ }
+ ASSERT_STREQ(app->QueryExeLocation(), L"hello");
+ }
+}
+
+
diff --git a/test/CommonLibTests/stdafx.h b/test/CommonLibTests/stdafx.h
index e7c8024eda..ed238e1b3d 100644
--- a/test/CommonLibTests/stdafx.h
+++ b/test/CommonLibTests/stdafx.h
@@ -39,9 +39,9 @@
#include "stringa.h"
#include "multisz.h"
#include "dbgutil.h"
-#include "ahutil.h"
#include "hashfn.h"
+#include "requesthandler_config.h"
#include "hostfxr_utility.h"
#include "environmentvariablehash.h"
#include "iapplication.h"
@@ -54,3 +54,11 @@
#undef assert // Macro redefinition in IISLib.
#include "gtest\gtest.h"
+
+// Externals defined in inprocess
+BOOL g_fProcessDetach;
+HANDLE g_hEventLog;
+DWORD g_dwAspNetCoreDebugFlags;
+PCSTR g_szDebugLabel;
+DWORD g_dwDebugFlags;
+
diff --git a/test/IISIntegration.FunctionalTests/Inprocess/StartupExceptionTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/StartupExceptionTests.cs
index 6ca6a200cc..79b92c3424 100644
--- a/test/IISIntegration.FunctionalTests/Inprocess/StartupExceptionTests.cs
+++ b/test/IISIntegration.FunctionalTests/Inprocess/StartupExceptionTests.cs
@@ -11,13 +11,14 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public class StartupExceptionTests : IISFunctionalTestBase
{
-
+ // TODO FileNotFound here.
[Theory]
[InlineData("CheckLogFile")]
[InlineData("CheckErrLogFile")]
public async Task CheckStdoutWithRandomNumber(string path)
{
var deploymentParameters = Helpers.GetBaseDeploymentParameters("StartupExceptionWebsite");
+ deploymentParameters.PublishApplicationBeforeDeployment = true;
deploymentParameters.EnvironmentVariables["ASPNETCORE_INPROCESS_STARTUP_VALUE"] = path;
var randomNumberString = new Random(Guid.NewGuid().GetHashCode()).Next(10000000).ToString();
deploymentParameters.EnvironmentVariables["ASPNETCORE_INPROCESS_RANDOM_VALUE"] = randomNumberString;
@@ -39,6 +40,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public async Task CheckStdoutWithLargeWrites(string path)
{
var deploymentParameters = Helpers.GetBaseDeploymentParameters("StartupExceptionWebsite");
+ deploymentParameters.PublishApplicationBeforeDeployment = true;
deploymentParameters.EnvironmentVariables["ASPNETCORE_INPROCESS_STARTUP_VALUE"] = path;
var deploymentResult = await DeployAsync(deploymentParameters);