Add tracing to shimconfig (#964)
This commit is contained in:
parent
aeebcdefc1
commit
d3d257b90e
|
|
@ -24,66 +24,52 @@ class ASPNETCORE_SHIM_CONFIG
|
|||
{
|
||||
public:
|
||||
virtual
|
||||
~ASPNETCORE_SHIM_CONFIG();
|
||||
~ASPNETCORE_SHIM_CONFIG() = default;
|
||||
|
||||
HRESULT
|
||||
Populate(
|
||||
IHttpServer *pHttpServer,
|
||||
IHttpApplication *pHttpContext
|
||||
IHttpApplication *pHttpApplication
|
||||
);
|
||||
|
||||
STRU*
|
||||
QueryApplicationPhysicalPath(
|
||||
VOID
|
||||
)
|
||||
QueryApplicationPhysicalPath()
|
||||
{
|
||||
return &m_struApplicationPhysicalPath;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryApplicationPath(
|
||||
VOID
|
||||
)
|
||||
QueryApplicationPath()
|
||||
{
|
||||
return &m_struApplication;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryConfigPath(
|
||||
VOID
|
||||
)
|
||||
QueryConfigPath()
|
||||
{
|
||||
return &m_struConfigPath;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryProcessPath(
|
||||
VOID
|
||||
)
|
||||
QueryProcessPath()
|
||||
{
|
||||
return &m_struProcessPath;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryArguments(
|
||||
VOID
|
||||
)
|
||||
QueryArguments()
|
||||
{
|
||||
return &m_struArguments;
|
||||
}
|
||||
|
||||
APP_HOSTING_MODEL
|
||||
QueryHostingModel(
|
||||
VOID
|
||||
)
|
||||
QueryHostingModel()
|
||||
{
|
||||
return m_hostingModel;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryHandlerVersion(
|
||||
VOID
|
||||
)
|
||||
QueryHandlerVersion()
|
||||
{
|
||||
return &m_struHandlerVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,63 +7,36 @@
|
|||
#include "hostfxr_utility.h"
|
||||
#include "ahutil.h"
|
||||
|
||||
ASPNETCORE_SHIM_CONFIG::~ASPNETCORE_SHIM_CONFIG()
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT
|
||||
ASPNETCORE_SHIM_CONFIG::Populate(
|
||||
IHttpServer *pHttpServer,
|
||||
IHttpApplication *pHttpApplication
|
||||
)
|
||||
{
|
||||
STACK_STRU(strHostingModel, 300);
|
||||
HRESULT hr = S_OK;
|
||||
STACK_STRU(strHostingModel, 12);
|
||||
STRU strApplicationFullPath;
|
||||
IAppHostAdminManager *pAdminManager = NULL;
|
||||
IAppHostElement *pAspNetCoreElement = NULL;
|
||||
BSTR bstrAspNetCoreSection = NULL;
|
||||
CComPtr<IAppHostElement> pAspNetCoreElement;
|
||||
|
||||
pAdminManager = pHttpServer->GetAdminManager();
|
||||
hr = m_struConfigPath.Copy(pHttpApplication->GetAppConfigPath());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
RETURN_IF_FAILED(m_struConfigPath.Copy(pHttpApplication->GetAppConfigPath()));
|
||||
RETURN_IF_FAILED(m_struApplicationPhysicalPath.Copy(pHttpApplication->GetApplicationPhysicalPath()));
|
||||
|
||||
hr = m_struApplicationPhysicalPath.Copy(pHttpApplication->GetApplicationPhysicalPath());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
const CComBSTR bstrAspNetCoreSection = CS_ASPNETCORE_SECTION;
|
||||
|
||||
bstrAspNetCoreSection = SysAllocString(CS_ASPNETCORE_SECTION);
|
||||
|
||||
hr = pAdminManager->GetAdminSection(bstrAspNetCoreSection,
|
||||
RETURN_IF_FAILED(pAdminManager->GetAdminSection(bstrAspNetCoreSection,
|
||||
m_struConfigPath.QueryStr(),
|
||||
&pAspNetCoreElement);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
&pAspNetCoreElement));
|
||||
|
||||
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||
RETURN_IF_FAILED(GetElementStringProperty(pAspNetCoreElement,
|
||||
CS_ASPNETCORE_PROCESS_EXE_PATH,
|
||||
&m_struProcessPath);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
&m_struProcessPath));
|
||||
|
||||
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||
// Swallow this error for backward compatability
|
||||
// Use default behavior for empty string
|
||||
GetElementStringProperty(pAspNetCoreElement,
|
||||
CS_ASPNETCORE_HOSTING_MODEL,
|
||||
&strHostingModel);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// Swallow this error for backward compatability
|
||||
// Use default behavior for empty string
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
if (strHostingModel.IsEmpty() || strHostingModel.Equals(L"outofprocess", TRUE))
|
||||
{
|
||||
|
|
@ -76,27 +49,14 @@ ASPNETCORE_SHIM_CONFIG::Populate(
|
|||
else
|
||||
{
|
||||
// block unknown hosting value
|
||||
hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
|
||||
goto Finished;
|
||||
RETURN_IF_FAILED(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED));
|
||||
}
|
||||
|
||||
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||
RETURN_IF_FAILED(GetElementStringProperty(pAspNetCoreElement,
|
||||
CS_ASPNETCORE_PROCESS_ARGUMENTS,
|
||||
&m_struArguments);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
&m_struArguments));
|
||||
|
||||
hr = ConfigUtility::FindHandlerVersion(pAspNetCoreElement, &m_struHandlerVersion);
|
||||
RETURN_IF_FAILED(ConfigUtility::FindHandlerVersion(pAspNetCoreElement, &m_struHandlerVersion));
|
||||
|
||||
Finished:
|
||||
|
||||
if (pAspNetCoreElement != NULL)
|
||||
{
|
||||
pAspNetCoreElement->Release();
|
||||
pAspNetCoreElement = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue