Merge branch 'merge/release/2.2-to-master'
This commit is contained in:
commit
deed3a417e
|
|
@ -126,7 +126,7 @@
|
||||||
<MSBuild
|
<MSBuild
|
||||||
Projects="$(StressAppBasePath)\StressTestWebSite.csproj"
|
Projects="$(StressAppBasePath)\StressTestWebSite.csproj"
|
||||||
Targets="Publish"
|
Targets="Publish"
|
||||||
Properties="TargetFramework=netcoreapp2.2;Configuration=$(Configuration);RuntimeIdentifier=win7-%(Platforms.Identity);PublishDir=$(StressAppPublishPath)\%(Identity)" />
|
Properties="TargetFramework=netcoreapp2.2;Configuration=$(Configuration);RuntimeIdentifier=win7-%(Platforms.Identity);PublishDir=$(StressAppPublishPath)\%(Identity);BuildProjectReferences=false" />
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<StressAppFiles Include="$(StressAppPublishPath)\**\*" />
|
<StressAppFiles Include="$(StressAppPublishPath)\**\*" />
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,17 @@ public:
|
||||||
|
|
||||||
HRESULT Execute(
|
HRESULT Execute(
|
||||||
_In_ IHttpServer *pServer,
|
_In_ IHttpServer *pServer,
|
||||||
_In_ const IHttpApplication *pHttpApplication,
|
_In_ IHttpContext *pHttpContext,
|
||||||
_Outptr_ IAPPLICATION **pApplication) const noexcept
|
_Outptr_ IAPPLICATION **pApplication) const
|
||||||
{
|
{
|
||||||
std::array<APPLICATION_PARAMETER, 1> parameters {
|
std::array<APPLICATION_PARAMETER, 2> parameters {
|
||||||
{"InProcessExeLocation", m_location.data()}
|
{
|
||||||
|
{"InProcessExeLocation", m_location.data()},
|
||||||
|
{"TraceContext", pHttpContext->GetTraceContext()}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return m_pfnAspNetCoreCreateApplication(pServer, pHttpApplication, parameters.data(), static_cast<DWORD>(parameters.size()), pApplication);
|
|
||||||
|
return m_pfnAspNetCoreCreateApplication(pServer, pHttpContext->GetApplication(), parameters.data(), static_cast<DWORD>(parameters.size()), pApplication);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,21 @@
|
||||||
#include "DisconnectHandler.h"
|
#include "DisconnectHandler.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "proxymodule.h"
|
#include "proxymodule.h"
|
||||||
|
#include "SRWExclusiveLock.h"
|
||||||
|
|
||||||
void DisconnectHandler::NotifyDisconnect()
|
void DisconnectHandler::NotifyDisconnect()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const auto module = m_pModule.exchange(nullptr);
|
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> module;
|
||||||
|
{
|
||||||
|
SRWExclusiveLock lock(m_handlerLock);
|
||||||
|
m_pHandler.swap(module);
|
||||||
|
}
|
||||||
|
|
||||||
if (module != nullptr)
|
if (module != nullptr)
|
||||||
{
|
{
|
||||||
module ->NotifyDisconnect();
|
module->NotifyDisconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
@ -27,7 +33,8 @@ void DisconnectHandler::CleanupStoredContext() noexcept
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisconnectHandler::SetHandler(ASPNET_CORE_PROXY_MODULE * module) noexcept
|
void DisconnectHandler::SetHandler(std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> handler) noexcept
|
||||||
{
|
{
|
||||||
m_pModule = module;
|
SRWExclusiveLock lock(m_handlerLock);
|
||||||
|
handler.swap(m_pHandler);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <atomic>
|
|
||||||
|
#include <memory>
|
||||||
|
#include "irequesthandler.h"
|
||||||
|
|
||||||
class ASPNET_CORE_PROXY_MODULE;
|
class ASPNET_CORE_PROXY_MODULE;
|
||||||
|
|
||||||
|
|
@ -10,8 +12,9 @@ class DisconnectHandler final: public IHttpConnectionStoredContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DisconnectHandler()
|
DisconnectHandler()
|
||||||
: m_pModule(nullptr)
|
: m_pHandler(nullptr)
|
||||||
{
|
{
|
||||||
|
InitializeSRWLock(&m_handlerLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
|
|
@ -27,9 +30,10 @@ public:
|
||||||
CleanupStoredContext() noexcept override;
|
CleanupStoredContext() noexcept override;
|
||||||
|
|
||||||
void
|
void
|
||||||
SetHandler(ASPNET_CORE_PROXY_MODULE * module) noexcept;
|
SetHandler(std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> handler) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::atomic<ASPNET_CORE_PROXY_MODULE*> m_pModule;
|
SRWLOCK m_handlerLock {};
|
||||||
|
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> m_pHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,84 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title> HTTP Error 500.0 - ANCM In-Process Handler Load Failure </title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: .813em;
|
||||||
|
color: #222;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
<head>
|
h1, h2, h3, h4, h5 {
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
/*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
|
||||||
<title> IIS 500 Error </title>
|
font-weight: 100;
|
||||||
<style type="text/css"></style>
|
}
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
h1 {
|
||||||
<div id="content">
|
color: #44525e;
|
||||||
<div class="content-container">
|
margin: 15px 0 15px 0;
|
||||||
<h3> HTTP Error 500.0 - ANCM InProcess Startup Failure </h3>
|
}
|
||||||
</div>
|
|
||||||
<div class="content-container">
|
|
||||||
<fieldset>
|
|
||||||
<h4> Common causes of this issue: </h4>
|
|
||||||
<ul>
|
|
||||||
<li> The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. </li>
|
|
||||||
<li> The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application. </li>
|
|
||||||
<li> ANCM could not find dotnet. </li>
|
|
||||||
</ul>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
<div class="content-container">
|
|
||||||
<fieldset>
|
|
||||||
<h4> Troubleshooting steps: </h4>
|
|
||||||
<ul>
|
|
||||||
<li> Check the system event log for error messages </li>
|
|
||||||
<li> Enable logging the application process' stdout messages </li>
|
|
||||||
<li> Attach a debugger to the application process and inspect </li>
|
|
||||||
</ul>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<h4> For more information visit:
|
|
||||||
<a href="https://go.microsoft.com/fwlink/?LinkID=808681">
|
|
||||||
<cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite>
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 10px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #363636;
|
||||||
|
margin: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, "Courier New", courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .titleerror {
|
||||||
|
padding: 3px 3px 6px 3px;
|
||||||
|
display: block;
|
||||||
|
font-size: 1.5em;
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1ba1e2;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #13709e;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> HTTP Error 500.0 - ANCM In-Process Handler Load Failure </h1>
|
||||||
|
|
||||||
|
<h2> Common causes of this issue: </h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li> The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. </li>
|
||||||
|
<li> The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application. </li>
|
||||||
|
<li> ANCM could not find dotnet. </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2> Troubleshooting steps: </h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li> Check the system event log for error messages </li>
|
||||||
|
<li> Enable logging the application process' stdout messages </li>
|
||||||
|
<li> Attach a debugger to the application process and inspect </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
For more information visit:
|
||||||
|
%s <a href="https://go.microsoft.com/fwlink/?LinkID=2028526"> <cite> https://go.microsoft.com/fwlink/?LinkID=2028526 </cite> </a>
|
||||||
|
</h2>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,81 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title> HTTP Error 500.0 - ANCM Out-Of-Process Handler Load Failure </title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: .813em;
|
||||||
|
color: #222;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
<head>
|
h1, h2, h3, h4, h5 {
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
/*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
|
||||||
<title> IIS 500 Error </title>
|
font-weight: 100;
|
||||||
<style type="text/css"></style>
|
}
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
h1 {
|
||||||
<div id="content">
|
color: #44525e;
|
||||||
<div class="content-container">
|
margin: 15px 0 15px 0;
|
||||||
<h3> HTTP Error 500.0 - ANCM OutOfProcess Startup Failure </h3>
|
}
|
||||||
</div>
|
|
||||||
<div class="content-container">
|
|
||||||
<fieldset>
|
|
||||||
<h4> Common causes of this issue: </h4>
|
|
||||||
<ul>
|
|
||||||
<li>The out of process request handler, aspnetcorev2_outofprocess.dll, could not be found next to the aspnetcorev2.dll.</li>
|
|
||||||
<li> Could not read configuration correctly. Check the application's associated web.config.</li>
|
|
||||||
</ul>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
<div class="content-container">
|
|
||||||
<fieldset>
|
|
||||||
<h4> Troubleshooting steps: </h4>
|
|
||||||
<ul>
|
|
||||||
<li> Check the system event log for error messages </li>
|
|
||||||
<li> Enable logging the application process' stdout messages </li>
|
|
||||||
<li> Attach a debugger to the application process and inspect </li>
|
|
||||||
</ul>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<h4> For more information visit:
|
|
||||||
<a href="https://go.microsoft.com/fwlink/?LinkID=808681">
|
|
||||||
<cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite>
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
h2 {
|
||||||
|
margin: 10px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #363636;
|
||||||
|
margin: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, "Courier New", courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .titleerror {
|
||||||
|
padding: 3px 3px 6px 3px;
|
||||||
|
display: block;
|
||||||
|
font-size: 1.5em;
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1ba1e2;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #13709e;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> HTTP Error 500.0 - ANCM Out-Of-Process Handler Load Failure </h1>
|
||||||
|
|
||||||
|
<h2> Common causes of this issue: </h2>
|
||||||
|
<ul>
|
||||||
|
<li>The out of process request handler, aspnetcorev2_outofprocess.dll, could not be found next to the aspnetcorev2.dll.</li>
|
||||||
|
<li> Could not read configuration correctly. Check the application's associated web.config.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2> Troubleshooting steps: </h2>
|
||||||
|
<ul>
|
||||||
|
<li> Check the system event log for error messages </li>
|
||||||
|
<li> Enable logging the application process' stdout messages </li>
|
||||||
|
<li> Attach a debugger to the application process and inspect </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
For more information visit:
|
||||||
|
%s <a href="https://go.microsoft.com/fwlink/?LinkID=2028526"> <cite> https://go.microsoft.com/fwlink/?LinkID=2028526 </cite> </a>
|
||||||
|
</h2>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public:
|
||||||
|
|
||||||
HRESULT CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler) override
|
HRESULT CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler) override
|
||||||
{
|
{
|
||||||
auto handler = std::make_unique<ServerErrorHandler>(*pHttpContext, m_HR, m_moduleInstance, m_disableStartupPage, m_page);
|
auto handler = std::make_unique<ServerErrorHandler>(*pHttpContext, 500ui16, 0ui16, "Internal Server Error", m_HR, m_moduleInstance, m_disableStartupPage, m_page);
|
||||||
*pRequestHandler = handler.release();
|
*pRequestHandler = handler.release();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -39,4 +39,3 @@ private:
|
||||||
int m_page;
|
int m_page;
|
||||||
HINSTANCE m_moduleInstance;
|
HINSTANCE m_moduleInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -186,12 +186,28 @@ class ANCMWinHttpCallBack:ANCM_Events
|
||||||
};
|
};
|
||||||
|
|
||||||
[Dynamic,
|
[Dynamic,
|
||||||
Description("Inprocess executing request failure") : amended,
|
Description("Starting inprocess execute request") : amended,
|
||||||
EventType(7),
|
EventType(8),
|
||||||
EventLevel(2),
|
EventLevel(4),
|
||||||
EventTypeName("ANCM_EXECUTE_REQUEST_FAIL") : amended
|
EventTypeName("ANCM_INPROC_EXECUTE_REQUEST_START") : amended
|
||||||
]
|
]
|
||||||
class ANCMExecuteFailed:ANCM_Events
|
class ANCMExecuteStart:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Ending inprocess execute request") : amended,
|
||||||
|
EventType(10),
|
||||||
|
EventLevel(5),
|
||||||
|
EventTypeName("ANCM_INPROC_EXECUTE_REQUEST_COMPLETION") : amended
|
||||||
|
]
|
||||||
|
class ANCMExecuteEnd:ANCM_Events
|
||||||
{
|
{
|
||||||
[WmiDataId(1),
|
[WmiDataId(1),
|
||||||
Description("Context ID") : amended,
|
Description("Context ID") : amended,
|
||||||
|
|
@ -200,9 +216,93 @@ class ANCMExecuteFailed:ANCM_Events
|
||||||
read]
|
read]
|
||||||
object ContextId;
|
object ContextId;
|
||||||
[WmiDataId(2),
|
[WmiDataId(2),
|
||||||
Description("InternetStatus") : amended,
|
Description("Notification status") : amended,
|
||||||
format("x"),
|
format("d"),
|
||||||
read]
|
read]
|
||||||
uint32 ErrorCode;
|
uint32 requestStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Starting inprocess async completion") : amended,
|
||||||
|
EventType(8),
|
||||||
|
EventLevel(5),
|
||||||
|
EventTypeName("ANCM_INPROC_ASYNC_COMPLETION_START") : amended
|
||||||
|
]
|
||||||
|
class ANCMAsyncStart:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Ending inprocess async completion") : amended,
|
||||||
|
EventType(10),
|
||||||
|
EventLevel(5),
|
||||||
|
EventTypeName("ANCM_INPROC_ASYNC_COMPLETION_COMPLETION") : amended
|
||||||
|
]
|
||||||
|
class ANCMAsyncEnd:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
[WmiDataId(2),
|
||||||
|
Description("Notification status") : amended,
|
||||||
|
format("d"),
|
||||||
|
read]
|
||||||
|
uint32 requestStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Inprocess app shutdown") : amended,
|
||||||
|
EventType(11),
|
||||||
|
EventLevel(4),
|
||||||
|
EventTypeName("ANCM_INPROC_REQUEST_SHUTDOWN") : amended
|
||||||
|
]
|
||||||
|
class ANCMRequestShutdown:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Inprocess request disconnect") : amended,
|
||||||
|
EventType(12),
|
||||||
|
EventLevel(4),
|
||||||
|
EventTypeName("ANCM_INPROC_REQUEST_DISCONNECT") : amended
|
||||||
|
]
|
||||||
|
class ANCMRequestDisconnect:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Dynamic,
|
||||||
|
Description("Indicate managed request complete") : amended,
|
||||||
|
EventType(12),
|
||||||
|
EventLevel(4),
|
||||||
|
EventTypeName("ANCM_INPROC_MANAGED_REQUEST_COMPLETION") : amended
|
||||||
|
]
|
||||||
|
class ANCMManagedRequestCompletion:ANCM_Events
|
||||||
|
{
|
||||||
|
[WmiDataId(1),
|
||||||
|
Description("Context ID") : amended,
|
||||||
|
extension("Guid"),
|
||||||
|
ActivityID,
|
||||||
|
read]
|
||||||
|
object ContextId;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ APPLICATION_INFO::CreateHandler(
|
||||||
// check if other thread created application
|
// check if other thread created application
|
||||||
RETURN_IF_FAILED(hr = TryCreateHandler(pHttpContext, pHandler));
|
RETURN_IF_FAILED(hr = TryCreateHandler(pHttpContext, pHandler));
|
||||||
|
|
||||||
// In some cases (adding and removing app_offline quickly) application might start and stop immediately
|
// In some cases (adding and removing app_offline quickly) application might start and stop immediately
|
||||||
// so retry until we get valid handler or error
|
// so retry until we get valid handler or error
|
||||||
while (hr != S_OK)
|
while (hr != S_OK)
|
||||||
{
|
{
|
||||||
|
|
@ -59,7 +59,7 @@ APPLICATION_INFO::CreateHandler(
|
||||||
m_pApplicationFactory = nullptr;
|
m_pApplicationFactory = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_IF_FAILED(CreateApplication(*pHttpContext.GetApplication()));
|
RETURN_IF_FAILED(CreateApplication(pHttpContext));
|
||||||
|
|
||||||
RETURN_IF_FAILED(hr = TryCreateHandler(pHttpContext, pHandler));
|
RETURN_IF_FAILED(hr = TryCreateHandler(pHttpContext, pHandler));
|
||||||
}
|
}
|
||||||
|
|
@ -69,8 +69,9 @@ APPLICATION_INFO::CreateHandler(
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
APPLICATION_INFO::CreateApplication(const IHttpApplication& pHttpApplication)
|
APPLICATION_INFO::CreateApplication(IHttpContext& pHttpContext)
|
||||||
{
|
{
|
||||||
|
auto& pHttpApplication = *pHttpContext.GetApplication();
|
||||||
if (AppOfflineApplication::ShouldBeStarted(pHttpApplication))
|
if (AppOfflineApplication::ShouldBeStarted(pHttpApplication))
|
||||||
{
|
{
|
||||||
LOG_INFO(L"Detected app_offline file, creating polling application");
|
LOG_INFO(L"Detected app_offline file, creating polling application");
|
||||||
|
|
@ -85,7 +86,7 @@ APPLICATION_INFO::CreateApplication(const IHttpApplication& pHttpApplication)
|
||||||
const WebConfigConfigurationSource configurationSource(m_pServer.GetAdminManager(), pHttpApplication);
|
const WebConfigConfigurationSource configurationSource(m_pServer.GetAdminManager(), pHttpApplication);
|
||||||
ShimOptions options(configurationSource);
|
ShimOptions options(configurationSource);
|
||||||
|
|
||||||
const auto hr = TryCreateApplication(pHttpApplication, options);
|
const auto hr = TryCreateApplication(pHttpContext, options);
|
||||||
|
|
||||||
if (FAILED_LOG(hr))
|
if (FAILED_LOG(hr))
|
||||||
{
|
{
|
||||||
|
|
@ -130,15 +131,15 @@ APPLICATION_INFO::CreateApplication(const IHttpApplication& pHttpApplication)
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
APPLICATION_INFO::TryCreateApplication(const IHttpApplication& pHttpApplication, const ShimOptions& options)
|
APPLICATION_INFO::TryCreateApplication(IHttpContext& pHttpContext, const ShimOptions& options)
|
||||||
{
|
{
|
||||||
RETURN_IF_FAILED(m_handlerResolver.GetApplicationFactory(pHttpApplication, m_pApplicationFactory, options));
|
RETURN_IF_FAILED(m_handlerResolver.GetApplicationFactory(*pHttpContext.GetApplication(), m_pApplicationFactory, options));
|
||||||
LOG_INFO(L"Creating handler application");
|
LOG_INFO(L"Creating handler application");
|
||||||
|
|
||||||
IAPPLICATION * newApplication;
|
IAPPLICATION * newApplication;
|
||||||
RETURN_IF_FAILED(m_pApplicationFactory->Execute(
|
RETURN_IF_FAILED(m_pApplicationFactory->Execute(
|
||||||
&m_pServer,
|
&m_pServer,
|
||||||
&pHttpApplication,
|
&pHttpContext,
|
||||||
&newApplication));
|
&newApplication));
|
||||||
|
|
||||||
m_pApplication.reset(newApplication);
|
m_pApplication.reset(newApplication);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public:
|
||||||
CreateHandler(
|
CreateHandler(
|
||||||
IHttpContext& pHttpContext,
|
IHttpContext& pHttpContext,
|
||||||
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER>& pHandler);
|
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER>& pHandler);
|
||||||
|
|
||||||
bool ConfigurationPathApplies(const std::wstring& path)
|
bool ConfigurationPathApplies(const std::wstring& path)
|
||||||
{
|
{
|
||||||
// We need to check that the last character of the config path
|
// We need to check that the last character of the config path
|
||||||
|
|
@ -67,17 +67,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
TryCreateHandler(
|
TryCreateHandler(
|
||||||
IHttpContext& pHttpContext,
|
IHttpContext& pHttpContext,
|
||||||
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER>& pHandler);
|
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER>& pHandler);
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
CreateApplication(const IHttpApplication& pHttpApplication);
|
CreateApplication(IHttpContext& pHttpContext);
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
TryCreateApplication(const IHttpApplication& pHttpApplication, const ShimOptions& options);
|
TryCreateApplication(IHttpContext& pHttpContext, const ShimOptions& options);
|
||||||
|
|
||||||
IHttpServer &m_pServer;
|
IHttpServer &m_pServer;
|
||||||
HandlerResolver &m_handlerResolver;
|
HandlerResolver &m_handlerResolver;
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,7 @@ ASPNET_CORE_PROXY_MODULE::ASPNET_CORE_PROXY_MODULE(HTTP_MODULE_ID moduleId, std:
|
||||||
|
|
||||||
ASPNET_CORE_PROXY_MODULE::~ASPNET_CORE_PROXY_MODULE()
|
ASPNET_CORE_PROXY_MODULE::~ASPNET_CORE_PROXY_MODULE()
|
||||||
{
|
{
|
||||||
if (m_pDisconnectHandler != nullptr)
|
RemoveDisconnectHandler();
|
||||||
{
|
|
||||||
m_pDisconnectHandler->SetHandler(nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__override
|
__override
|
||||||
|
|
@ -94,25 +91,6 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
||||||
FINISHED(HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS));
|
FINISHED(HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto moduleContainer = pHttpContext
|
|
||||||
->GetConnection()
|
|
||||||
->GetModuleContextContainer();
|
|
||||||
|
|
||||||
#pragma warning( push )
|
|
||||||
#pragma warning ( disable : 26466 ) // Disable "Don't use static_cast downcasts". We build without RTTI support so dynamic_cast is not available
|
|
||||||
m_pDisconnectHandler = static_cast<DisconnectHandler*>(moduleContainer->GetConnectionModuleContext(m_moduleId));
|
|
||||||
#pragma warning( push )
|
|
||||||
|
|
||||||
if (m_pDisconnectHandler == nullptr)
|
|
||||||
{
|
|
||||||
auto disconnectHandler = std::make_unique<DisconnectHandler>();
|
|
||||||
m_pDisconnectHandler = disconnectHandler.get();
|
|
||||||
// ModuleContextContainer takes ownership of disconnectHandler
|
|
||||||
// we are trusting that it would not release it before deleting the context
|
|
||||||
FINISHED_IF_FAILED(moduleContainer->SetConnectionModuleContext(static_cast<IHttpConnectionStoredContext*>(disconnectHandler.release()), m_moduleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pDisconnectHandler->SetHandler(this);
|
|
||||||
|
|
||||||
FINISHED_IF_FAILED(m_pApplicationManager->GetOrCreateApplicationInfo(
|
FINISHED_IF_FAILED(m_pApplicationManager->GetOrCreateApplicationInfo(
|
||||||
*pHttpContext,
|
*pHttpContext,
|
||||||
|
|
@ -120,6 +98,8 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
||||||
|
|
||||||
FINISHED_IF_FAILED(m_pApplicationInfo->CreateHandler(*pHttpContext, m_pHandler));
|
FINISHED_IF_FAILED(m_pApplicationInfo->CreateHandler(*pHttpContext, m_pHandler));
|
||||||
|
|
||||||
|
SetupDisconnectHandler(pHttpContext);
|
||||||
|
|
||||||
retVal = m_pHandler->OnExecuteRequestHandler();
|
retVal = m_pHandler->OnExecuteRequestHandler();
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
@ -141,7 +121,7 @@ Finished:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return HandleNotificationStatus(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
__override
|
__override
|
||||||
|
|
@ -156,18 +136,62 @@ ASPNET_CORE_PROXY_MODULE::OnAsyncCompletion(
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return m_pHandler->OnAsyncCompletion(
|
return HandleNotificationStatus(m_pHandler->OnAsyncCompletion(
|
||||||
pCompletionInfo->GetCompletionBytes(),
|
pCompletionInfo->GetCompletionBytes(),
|
||||||
pCompletionInfo->GetCompletionStatus());
|
pCompletionInfo->GetCompletionStatus()));
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
OBSERVE_CAUGHT_EXCEPTION();
|
OBSERVE_CAUGHT_EXCEPTION();
|
||||||
return RQ_NOTIFICATION_FINISH_REQUEST;
|
return HandleNotificationStatus(RQ_NOTIFICATION_FINISH_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASPNET_CORE_PROXY_MODULE::NotifyDisconnect() const
|
REQUEST_NOTIFICATION_STATUS ASPNET_CORE_PROXY_MODULE::HandleNotificationStatus(REQUEST_NOTIFICATION_STATUS status) noexcept
|
||||||
{
|
{
|
||||||
m_pHandler->NotifyDisconnect();
|
if (status != RQ_NOTIFICATION_PENDING)
|
||||||
|
{
|
||||||
|
RemoveDisconnectHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASPNET_CORE_PROXY_MODULE::SetupDisconnectHandler(IHttpContext * pHttpContext)
|
||||||
|
{
|
||||||
|
auto moduleContainer = pHttpContext
|
||||||
|
->GetConnection()
|
||||||
|
->GetModuleContextContainer();
|
||||||
|
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning ( disable : 26466 ) // Disable "Don't use static_cast downcasts". We build without RTTI support so dynamic_cast is not available
|
||||||
|
auto pDisconnectHandler = static_cast<DisconnectHandler*>(moduleContainer->GetConnectionModuleContext(m_moduleId));
|
||||||
|
#pragma warning( push )
|
||||||
|
|
||||||
|
if (pDisconnectHandler == nullptr)
|
||||||
|
{
|
||||||
|
auto newHandler = std::make_unique<DisconnectHandler>();
|
||||||
|
pDisconnectHandler = newHandler.get();
|
||||||
|
// ModuleContextContainer takes ownership of disconnectHandler
|
||||||
|
// we are trusting that it would not release it before deleting the context
|
||||||
|
LOG_IF_FAILED(moduleContainer->SetConnectionModuleContext(static_cast<IHttpConnectionStoredContext*>(newHandler.release()), m_moduleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// make code analysis happy
|
||||||
|
if (pDisconnectHandler != nullptr)
|
||||||
|
{
|
||||||
|
pDisconnectHandler->SetHandler(::ReferenceRequestHandler(m_pHandler.get()));
|
||||||
|
m_pDisconnectHandler = pDisconnectHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASPNET_CORE_PROXY_MODULE::RemoveDisconnectHandler() noexcept
|
||||||
|
{
|
||||||
|
auto handler = m_pDisconnectHandler;
|
||||||
|
m_pDisconnectHandler = nullptr;
|
||||||
|
|
||||||
|
if (handler != nullptr)
|
||||||
|
{
|
||||||
|
handler->SetHandler(nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,14 @@ class ASPNET_CORE_PROXY_MODULE : NonCopyable, public CHttpModule
|
||||||
IHttpCompletionInfo * pCompletionInfo
|
IHttpCompletionInfo * pCompletionInfo
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
void
|
|
||||||
NotifyDisconnect() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
HandleNotificationStatus(REQUEST_NOTIFICATION_STATUS status) noexcept;
|
||||||
|
|
||||||
|
void SetupDisconnectHandler(IHttpContext * pHttpContext);
|
||||||
|
void RemoveDisconnectHandler() noexcept;
|
||||||
|
|
||||||
std::shared_ptr<APPLICATION_MANAGER> m_pApplicationManager;
|
std::shared_ptr<APPLICATION_MANAGER> m_pApplicationManager;
|
||||||
std::shared_ptr<APPLICATION_INFO> m_pApplicationInfo;
|
std::shared_ptr<APPLICATION_INFO> m_pApplicationInfo;
|
||||||
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> m_pHandler;
|
std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> m_pHandler;
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,8 @@
|
||||||
<ClInclude Include="IOutputManager.h" />
|
<ClInclude Include="IOutputManager.h" />
|
||||||
<ClInclude Include="irequesthandler.h" />
|
<ClInclude Include="irequesthandler.h" />
|
||||||
<ClInclude Include="LoggingHelpers.h" />
|
<ClInclude Include="LoggingHelpers.h" />
|
||||||
<ClInclude Include="ModuleHelpers.h" />
|
<ClInclude Include="ModuleHelpers.h" />
|
||||||
|
<ClInclude Include="ModuleTracer.h" />
|
||||||
<ClInclude Include="NonCopyable.h" />
|
<ClInclude Include="NonCopyable.h" />
|
||||||
<ClInclude Include="NullOutputManager.h" />
|
<ClInclude Include="NullOutputManager.h" />
|
||||||
<ClInclude Include="PipeOutputManager.h" />
|
<ClInclude Include="PipeOutputManager.h" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "aspnetcore_event.h"
|
||||||
|
|
||||||
|
class ModuleTracer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ModuleTracer(IHttpTraceContext* traceContext)
|
||||||
|
{
|
||||||
|
m_traceContext = traceContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ExecuteRequestStart()
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_EXECUTE_REQUEST_START::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_EXECUTE_REQUEST_START::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ExecuteRequestEnd(REQUEST_NOTIFICATION_STATUS status)
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_EXECUTE_REQUEST_COMPLETION::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_EXECUTE_REQUEST_COMPLETION::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL,
|
||||||
|
status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
AsyncCompletionStart()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ANCMEvents::ANCM_INPROC_ASYNC_COMPLETION_START::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_ASYNC_COMPLETION_START::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
AsyncCompletionEnd(REQUEST_NOTIFICATION_STATUS status)
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_ASYNC_COMPLETION_COMPLETION::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_ASYNC_COMPLETION_COMPLETION::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL,
|
||||||
|
status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RequestShutdown()
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_REQUEST_SHUTDOWN::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_REQUEST_SHUTDOWN::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RequestDisconnect()
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_REQUEST_DISCONNECT::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_REQUEST_DISCONNECT::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ManagedCompletion()
|
||||||
|
{
|
||||||
|
if (ANCMEvents::ANCM_INPROC_MANAGED_REQUEST_COMPLETION::IsEnabled(m_traceContext))
|
||||||
|
{
|
||||||
|
ANCMEvents::ANCM_INPROC_MANAGED_REQUEST_COMPLETION::RaiseEvent(
|
||||||
|
m_traceContext,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
IHttpTraceContext * m_traceContext;
|
||||||
|
};
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "SRWExclusiveLock.h"
|
#include "SRWExclusiveLock.h"
|
||||||
|
|
||||||
SRWExclusiveLock::SRWExclusiveLock(const SRWLOCK& lock)
|
SRWExclusiveLock::SRWExclusiveLock(const SRWLOCK& lock) noexcept
|
||||||
: m_lock(lock)
|
: m_lock(lock)
|
||||||
{
|
{
|
||||||
AcquireSRWLockExclusive(const_cast<SRWLOCK*>(&m_lock));
|
AcquireSRWLockExclusive(const_cast<SRWLOCK*>(&m_lock));
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
class SRWExclusiveLock
|
class SRWExclusiveLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SRWExclusiveLock(const SRWLOCK& lock);
|
SRWExclusiveLock(const SRWLOCK& lock) noexcept;
|
||||||
~SRWExclusiveLock();
|
~SRWExclusiveLock();
|
||||||
private:
|
private:
|
||||||
const SRWLOCK& m_lock;
|
const SRWLOCK& m_lock;
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,27 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "requesthandler.h"
|
#include "requesthandler.h"
|
||||||
#include "file_utility.h"
|
#include "file_utility.h"
|
||||||
|
#include "Environment.h"
|
||||||
|
|
||||||
class ServerErrorHandler : public REQUEST_HANDLER
|
class ServerErrorHandler : public REQUEST_HANDLER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ServerErrorHandler(IHttpContext &pContext, HRESULT hr, HINSTANCE moduleInstance, bool disableStartupPage, int page)
|
ServerErrorHandler(IHttpContext &pContext, USHORT statusCode, USHORT subStatusCode, std::string statusText, HRESULT hr, HINSTANCE moduleInstance, bool disableStartupPage, int page)
|
||||||
: m_pContext(pContext), m_HR(hr), m_disableStartupPage(disableStartupPage), m_page(page), m_moduleInstance(moduleInstance)
|
: m_pContext(pContext),
|
||||||
|
m_HR(hr),
|
||||||
|
m_disableStartupPage(disableStartupPage),
|
||||||
|
m_page(page),
|
||||||
|
m_moduleInstance(moduleInstance),
|
||||||
|
m_statusCode(statusCode),
|
||||||
|
m_subStatusCode(subStatusCode),
|
||||||
|
m_statusText(std::move(statusText))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUEST_NOTIFICATION_STATUS OnExecuteRequestHandler() override
|
REQUEST_NOTIFICATION_STATUS OnExecuteRequestHandler() override
|
||||||
{
|
{
|
||||||
static std::string s_html500Page = FILE_UTILITY::GetHtml(m_moduleInstance, m_page);
|
static std::string s_html500Page = GetHtml(m_moduleInstance, m_page);
|
||||||
|
|
||||||
WriteStaticResponse(m_pContext, s_html500Page, m_HR, m_disableStartupPage);
|
WriteStaticResponse(m_pContext, s_html500Page, m_HR, m_disableStartupPage);
|
||||||
|
|
||||||
|
|
@ -24,9 +32,68 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void WriteStaticResponse(IHttpContext& pContext, std::string &page, HRESULT hr, bool disableStartupErrorPage) const
|
||||||
|
{
|
||||||
|
if (disableStartupErrorPage)
|
||||||
|
{
|
||||||
|
pContext.GetResponse()->SetStatus(m_statusCode, m_statusText.c_str(), m_subStatusCode, E_FAIL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HTTP_DATA_CHUNK dataChunk = {};
|
||||||
|
IHttpResponse* pResponse = pContext.GetResponse();
|
||||||
|
pResponse->SetStatus(m_statusCode, m_statusText.c_str(), m_subStatusCode, hr, nullptr, true);
|
||||||
|
pResponse->SetHeader("Content-Type",
|
||||||
|
"text/html",
|
||||||
|
(USHORT)strlen("text/html"),
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
dataChunk.DataChunkType = HttpDataChunkFromMemory;
|
||||||
|
|
||||||
|
dataChunk.FromMemory.pBuffer = page.data();
|
||||||
|
dataChunk.FromMemory.BufferLength = static_cast<ULONG>(page.size());
|
||||||
|
pResponse->WriteEntityChunkByReference(&dataChunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
std::string
|
||||||
|
GetHtml(HMODULE module, int page)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HRSRC rc = nullptr;
|
||||||
|
HGLOBAL rcData = nullptr;
|
||||||
|
const char* data = nullptr;
|
||||||
|
|
||||||
|
THROW_LAST_ERROR_IF_NULL(rc = FindResource(module, MAKEINTRESOURCE(page), RT_HTML));
|
||||||
|
THROW_LAST_ERROR_IF_NULL(rcData = LoadResource(module, rc));
|
||||||
|
auto const size = SizeofResource(module, rc);
|
||||||
|
THROW_LAST_ERROR_IF(size == 0);
|
||||||
|
THROW_LAST_ERROR_IF_NULL(data = static_cast<const char*>(LockResource(rcData)));
|
||||||
|
|
||||||
|
auto additionalErrorLink = Environment::GetEnvironmentVariableValue(L"ANCM_ADDITIONAL_ERROR_PAGE_LINK");
|
||||||
|
std::string additionalHtml;
|
||||||
|
|
||||||
|
if (additionalErrorLink.has_value())
|
||||||
|
{
|
||||||
|
additionalHtml = format("<a href=\"%S\"> <cite> %S </cite></a> and ", additionalErrorLink->c_str(), additionalErrorLink->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return format(data, additionalHtml.c_str());
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
OBSERVE_CAUGHT_EXCEPTION();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IHttpContext &m_pContext;
|
IHttpContext &m_pContext;
|
||||||
HRESULT m_HR;
|
HRESULT m_HR;
|
||||||
bool m_disableStartupPage;
|
bool m_disableStartupPage;
|
||||||
int m_page;
|
int m_page;
|
||||||
HINSTANCE m_moduleInstance;
|
HINSTANCE m_moduleInstance;
|
||||||
|
USHORT m_statusCode;
|
||||||
|
USHORT m_subStatusCode;
|
||||||
|
std::string m_statusText;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -167,23 +167,3 @@ Finished:
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
FILE_UTILITY::GetHtml(HMODULE module, int page)
|
|
||||||
{
|
|
||||||
HRESULT hr = S_OK;
|
|
||||||
HRSRC rc = nullptr;
|
|
||||||
HGLOBAL rcData = nullptr;
|
|
||||||
const char* data = nullptr;
|
|
||||||
DWORD size = 0;
|
|
||||||
|
|
||||||
FINISHED_LAST_ERROR_IF_NULL(rc = FindResource(module, MAKEINTRESOURCE(page), RT_HTML));
|
|
||||||
FINISHED_LAST_ERROR_IF_NULL(rcData = LoadResource(module, rc));
|
|
||||||
size = SizeofResource(module, rc);
|
|
||||||
FINISHED_LAST_ERROR_IF(size == 0);
|
|
||||||
FINISHED_LAST_ERROR_IF_NULL(data = static_cast<const char*>(LockResource(rcData)));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
Finished:
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,9 @@ struct IREQUEST_HANDLER_DELETER
|
||||||
application->DereferenceRequestHandler();
|
application->DereferenceRequestHandler();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER> ReferenceRequestHandler(IREQUEST_HANDLER* handler)
|
||||||
|
{
|
||||||
|
handler->ReferenceRequestHandler();
|
||||||
|
return std::unique_ptr<IREQUEST_HANDLER, IREQUEST_HANDLER_DELETER>(handler);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,32 +46,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static
|
|
||||||
void WriteStaticResponse(IHttpContext& pContext, std::string &s_html500Page, HRESULT hr, bool disableStartupErrorPage)
|
|
||||||
{
|
|
||||||
if (disableStartupErrorPage)
|
|
||||||
{
|
|
||||||
pContext.GetResponse()->SetStatus(500, "Internal Server Error", 30, E_FAIL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTP_DATA_CHUNK dataChunk = {};
|
|
||||||
IHttpResponse* pResponse = pContext.GetResponse();
|
|
||||||
pResponse->SetStatus(500, "Internal Server Error", 0, hr, nullptr, true);
|
|
||||||
pResponse->SetHeader("Content-Type",
|
|
||||||
"text/html",
|
|
||||||
(USHORT)strlen("text/html"),
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
dataChunk.DataChunkType = HttpDataChunkFromMemory;
|
|
||||||
|
|
||||||
dataChunk.FromMemory.pBuffer = s_html500Page.data();
|
|
||||||
dataChunk.FromMemory.BufferLength = static_cast<ULONG>(s_html500Page.size());
|
|
||||||
pResponse->WriteEntityChunkByReference(&dataChunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable LONG m_cRefs = 1;
|
mutable LONG m_cRefs = 1;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,83 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title> HTTP Error 500.30 - ANCM In-Process Start Failure </title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: .813em;
|
||||||
|
color: #222;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
<head>
|
h1, h2, h3, h4, h5 {
|
||||||
|
/*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
h1 {
|
||||||
<title> IIS 500.30 Error </title>
|
color: #44525e;
|
||||||
<style type="text/css"></style>
|
margin: 15px 0 15px 0;
|
||||||
</head>
|
}
|
||||||
<body>
|
|
||||||
<div id="content">
|
|
||||||
|
|
||||||
<div class="content-container"><h3> HTTP Error 500.30 - ANCM In-Process Start Failure </h3></div>
|
h2 {
|
||||||
<div class="content-container">
|
margin: 10px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
<fieldset>
|
h3 {
|
||||||
<h4> Common causes of this issue: </h4>
|
color: #363636;
|
||||||
<ul>
|
margin: 5px 5px 0 0;
|
||||||
<li> The application failed to start </li>
|
}
|
||||||
<li> The application started but then stopped </li>
|
|
||||||
<li> The application started but threw an exception during startup </li>
|
|
||||||
</ul>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
<div class="content-container">
|
|
||||||
|
|
||||||
<fieldset>
|
code {
|
||||||
<h4> Troubleshooting steps: </h4>
|
font-family: Consolas, "Courier New", courier, monospace;
|
||||||
<ul>
|
}
|
||||||
<li> Check the system event log for error messages </li>
|
|
||||||
<li> Enable logging the application process' stdout messages </li>
|
body .titleerror {
|
||||||
<li> Attach a debugger to the application process and inspect </li>
|
padding: 3px 3px 6px 3px;
|
||||||
</ul>
|
display: block;
|
||||||
</fieldset>
|
font-size: 1.5em;
|
||||||
<fieldset>
|
font-weight: 100;
|
||||||
<h4>
|
}
|
||||||
For more information visit:
|
|
||||||
<a href="https://go.microsoft.com/fwlink/?LinkID =808681"> <cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite></a>
|
a {
|
||||||
</h4>
|
color: #1ba1e2;
|
||||||
</fieldset>
|
text-decoration: none;
|
||||||
</div>
|
}
|
||||||
</div>
|
|
||||||
</body>
|
a:hover {
|
||||||
|
color: #13709e;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> HTTP Error 500.30 - ANCM In-Process Start Failure </h1>
|
||||||
|
|
||||||
|
<h2> Common causes of this issue: </h2>
|
||||||
|
<ul>
|
||||||
|
<li> The application failed to start </li>
|
||||||
|
<li> The application started but then stopped </li>
|
||||||
|
<li> The application started but threw an exception during startup </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2> Troubleshooting steps: </h2>
|
||||||
|
<ul>
|
||||||
|
<li> Check the system event log for error messages </li>
|
||||||
|
<li> Enable logging the application process' stdout messages </li>
|
||||||
|
<li> Attach a debugger to the application process and inspect </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
For more information visit:
|
||||||
|
%s <a href="https://go.microsoft.com/fwlink/?LinkID=2028265"> <cite> https://go.microsoft.com/fwlink/?LinkID=2028265 </cite></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,9 @@ public:
|
||||||
|
|
||||||
~StartupExceptionApplication() = default;
|
~StartupExceptionApplication() = default;
|
||||||
|
|
||||||
HRESULT
|
HRESULT CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler)
|
||||||
CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler)
|
|
||||||
{
|
{
|
||||||
*pRequestHandler = new ServerErrorHandler(*pHttpContext, m_HR,m_moduleInstance, m_disableLogs, IN_PROCESS_RH_STATIC_HTML);
|
*pRequestHandler = new ServerErrorHandler(*pHttpContext, 500, 30, "Internal Server Error", m_HR, m_moduleInstance, m_disableLogs, IN_PROCESS_RH_STATIC_HTML);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "WebConfigConfigurationSource.h"
|
#include "WebConfigConfigurationSource.h"
|
||||||
#include "ConfigurationLoadException.h"
|
#include "ConfigurationLoadException.h"
|
||||||
#include "StartupExceptionApplication.h"
|
#include "StartupExceptionApplication.h"
|
||||||
|
#include "aspnetcore_event.h"
|
||||||
|
|
||||||
DECLARE_DEBUG_PRINT_OBJECT("aspnetcorev2_inprocess.dll");
|
DECLARE_DEBUG_PRINT_OBJECT("aspnetcorev2_inprocess.dll");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
#include "inprocesshandler.h"
|
#include "inprocesshandler.h"
|
||||||
#include "inprocessapplication.h"
|
#include "inprocessapplication.h"
|
||||||
#include "aspnetcore_event.h"
|
|
||||||
#include "IOutputManager.h"
|
#include "IOutputManager.h"
|
||||||
#include "ShuttingDownApplication.h"
|
#include "ShuttingDownApplication.h"
|
||||||
#include "ntassert.h"
|
#include "ntassert.h"
|
||||||
|
#include "ModuleTracer.h"
|
||||||
|
|
||||||
ALLOC_CACHE_HANDLER * IN_PROCESS_HANDLER::sm_pAlloc = NULL;
|
ALLOC_CACHE_HANDLER * IN_PROCESS_HANDLER::sm_pAlloc = NULL;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,8 @@ IN_PROCESS_HANDLER::IN_PROCESS_HANDLER(
|
||||||
m_pRequestHandler(pRequestHandler),
|
m_pRequestHandler(pRequestHandler),
|
||||||
m_pRequestHandlerContext(pRequestHandlerContext),
|
m_pRequestHandlerContext(pRequestHandlerContext),
|
||||||
m_pAsyncCompletionHandler(pAsyncCompletion),
|
m_pAsyncCompletionHandler(pAsyncCompletion),
|
||||||
m_pDisconnectHandler(pDisconnectHandler)
|
m_pDisconnectHandler(pDisconnectHandler),
|
||||||
|
m_moduleTracer(pW3Context->GetTraceContext())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,32 +35,11 @@ REQUEST_NOTIFICATION_STATUS
|
||||||
IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
||||||
{
|
{
|
||||||
// FREB log
|
// FREB log
|
||||||
|
m_moduleTracer.ExecuteRequestStart();
|
||||||
if (ANCMEvents::ANCM_START_APPLICATION_SUCCESS::IsEnabled(m_pW3Context->GetTraceContext()))
|
|
||||||
{
|
|
||||||
ANCMEvents::ANCM_START_APPLICATION_SUCCESS::RaiseEvent(
|
|
||||||
m_pW3Context->GetTraceContext(),
|
|
||||||
NULL,
|
|
||||||
L"InProcess Application");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pRequestHandler == NULL)
|
if (m_pRequestHandler == NULL)
|
||||||
{
|
{
|
||||||
//
|
m_moduleTracer.ExecuteRequestEnd(RQ_NOTIFICATION_FINISH_REQUEST);
|
||||||
// return error as the application did not register callback
|
|
||||||
//
|
|
||||||
if (ANCMEvents::ANCM_EXECUTE_REQUEST_FAIL::IsEnabled(m_pW3Context->GetTraceContext()))
|
|
||||||
{
|
|
||||||
ANCMEvents::ANCM_EXECUTE_REQUEST_FAIL::RaiseEvent(m_pW3Context->GetTraceContext(),
|
|
||||||
NULL,
|
|
||||||
(ULONG)E_APPLICATION_ACTIVATION_EXEC_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pW3Context->GetResponse()->SetStatus(500,
|
|
||||||
"Internal Server Error",
|
|
||||||
0,
|
|
||||||
(ULONG)E_APPLICATION_ACTIVATION_EXEC_FAILURE);
|
|
||||||
|
|
||||||
return RQ_NOTIFICATION_FINISH_REQUEST;
|
return RQ_NOTIFICATION_FINISH_REQUEST;
|
||||||
}
|
}
|
||||||
else if (m_pApplication->QueryBlockCallbacksIntoManaged())
|
else if (m_pApplication->QueryBlockCallbacksIntoManaged())
|
||||||
|
|
@ -67,7 +47,9 @@ IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
||||||
return ServerShutdownMessage();
|
return ServerShutdownMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_pRequestHandler(this, m_pRequestHandlerContext);
|
auto status = m_pRequestHandler(this, m_pRequestHandlerContext);
|
||||||
|
m_moduleTracer.ExecuteRequestEnd(status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
__override
|
__override
|
||||||
|
|
@ -77,10 +59,13 @@ IN_PROCESS_HANDLER::OnAsyncCompletion(
|
||||||
HRESULT hrCompletionStatus
|
HRESULT hrCompletionStatus
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
m_moduleTracer.AsyncCompletionStart();
|
||||||
|
|
||||||
if (m_fManagedRequestComplete)
|
if (m_fManagedRequestComplete)
|
||||||
{
|
{
|
||||||
// means PostCompletion has been called and this is the associated callback.
|
// means PostCompletion has been called and this is the associated callback.
|
||||||
return m_requestNotificationStatus;
|
m_moduleTracer.AsyncCompletionEnd(m_requestNotificationStatus);
|
||||||
|
return m_requestNotificationStatus;
|
||||||
}
|
}
|
||||||
if (m_pApplication->QueryBlockCallbacksIntoManaged())
|
if (m_pApplication->QueryBlockCallbacksIntoManaged())
|
||||||
{
|
{
|
||||||
|
|
@ -92,11 +77,15 @@ IN_PROCESS_HANDLER::OnAsyncCompletion(
|
||||||
|
|
||||||
assert(m_pManagedHttpContext != nullptr);
|
assert(m_pManagedHttpContext != nullptr);
|
||||||
// Call the managed handler for async completion.
|
// Call the managed handler for async completion.
|
||||||
return m_pAsyncCompletionHandler(m_pManagedHttpContext, hrCompletionStatus, cbCompletion);
|
|
||||||
|
auto status = m_pAsyncCompletionHandler(m_pManagedHttpContext, hrCompletionStatus, cbCompletion);
|
||||||
|
m_moduleTracer.AsyncCompletionEnd(status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUEST_NOTIFICATION_STATUS IN_PROCESS_HANDLER::ServerShutdownMessage() const
|
REQUEST_NOTIFICATION_STATUS IN_PROCESS_HANDLER::ServerShutdownMessage()
|
||||||
{
|
{
|
||||||
|
m_moduleTracer.RequestShutdown();
|
||||||
return ShuttingDownHandler::ServerShutdownMessage(m_pW3Context);
|
return ShuttingDownHandler::ServerShutdownMessage(m_pW3Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,6 +98,8 @@ IN_PROCESS_HANDLER::NotifyDisconnect()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_moduleTracer.RequestDisconnect();
|
||||||
|
|
||||||
assert(m_pManagedHttpContext != nullptr);
|
assert(m_pManagedHttpContext != nullptr);
|
||||||
m_pDisconnectHandler(m_pManagedHttpContext);
|
m_pDisconnectHandler(m_pManagedHttpContext);
|
||||||
}
|
}
|
||||||
|
|
@ -120,6 +111,7 @@ IN_PROCESS_HANDLER::IndicateManagedRequestComplete(
|
||||||
{
|
{
|
||||||
m_fManagedRequestComplete = TRUE;
|
m_fManagedRequestComplete = TRUE;
|
||||||
m_pManagedHttpContext = nullptr;
|
m_pManagedHttpContext = nullptr;
|
||||||
|
m_moduleTracer.ManagedCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "iapplication.h"
|
#include "iapplication.h"
|
||||||
#include "inprocessapplication.h"
|
#include "inprocessapplication.h"
|
||||||
|
#include "ModuleTracer.h"
|
||||||
|
|
||||||
class IN_PROCESS_APPLICATION;
|
class IN_PROCESS_APPLICATION;
|
||||||
|
|
||||||
|
|
@ -71,7 +72,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
REQUEST_NOTIFICATION_STATUS
|
REQUEST_NOTIFICATION_STATUS
|
||||||
ServerShutdownMessage() const;
|
ServerShutdownMessage();
|
||||||
|
|
||||||
PVOID m_pManagedHttpContext;
|
PVOID m_pManagedHttpContext;
|
||||||
BOOL m_fManagedRequestComplete;
|
BOOL m_fManagedRequestComplete;
|
||||||
|
|
@ -83,4 +84,5 @@ private:
|
||||||
PFN_ASYNC_COMPLETION_HANDLER m_pAsyncCompletionHandler;
|
PFN_ASYNC_COMPLETION_HANDLER m_pAsyncCompletionHandler;
|
||||||
PFN_DISCONNECT_HANDLER m_pDisconnectHandler;
|
PFN_DISCONNECT_HANDLER m_pDisconnectHandler;
|
||||||
static ALLOC_CACHE_HANDLER * sm_pAlloc;
|
static ALLOC_CACHE_HANDLER * sm_pAlloc;
|
||||||
|
ModuleTracer m_moduleTracer;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.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 LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// HTML
|
||||||
|
//
|
||||||
|
|
||||||
|
OUT_OF_PROCESS_RH_STATIC_HTML HTML "OutOfProcessRhStaticHtml.htm"
|
||||||
|
|
||||||
|
#endif // English (United States) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
@ -228,6 +228,7 @@
|
||||||
<ClInclude Include="forwarderconnection.h" />
|
<ClInclude Include="forwarderconnection.h" />
|
||||||
<ClInclude Include="processmanager.h" />
|
<ClInclude Include="processmanager.h" />
|
||||||
<ClInclude Include="protocolconfig.h" />
|
<ClInclude Include="protocolconfig.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="responseheaderhash.h" />
|
<ClInclude Include="responseheaderhash.h" />
|
||||||
<ClInclude Include="serverprocess.h" />
|
<ClInclude Include="serverprocess.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
|
|
@ -268,9 +269,13 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="HtmlResponses.rc" />
|
||||||
<ResourceCompile Include="outofprocessrequesthandler.rc" />
|
<ResourceCompile Include="outofprocessrequesthandler.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="OutOfProcessRhStaticHtml.htm">
|
||||||
|
<DeploymentContent>true</DeploymentContent>
|
||||||
|
</None>
|
||||||
<None Include="Source.def" />
|
<None Include="Source.def" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\..\build\native.targets" />
|
<Import Project="..\..\..\build\native.targets" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title> HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure </title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: .813em;
|
||||||
|
color: #222;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5 {
|
||||||
|
/*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #44525e;
|
||||||
|
margin: 15px 0 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 10px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #363636;
|
||||||
|
margin: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, "Courier New", courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .titleerror {
|
||||||
|
padding: 3px 3px 6px 3px;
|
||||||
|
display: block;
|
||||||
|
font-size: 1.5em;
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1ba1e2;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #13709e;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure </h1>
|
||||||
|
|
||||||
|
<h1> Common causes of this issue: </h1>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li> The application process failed to start </li>
|
||||||
|
<li> The application process started but then stopped </li>
|
||||||
|
<li> The application process started but failed to listen on the configured port </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4> Troubleshooting steps: </h4>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li> Check the system event log for error messages </li>
|
||||||
|
<li> Enable logging the application process' stdout messages </li>
|
||||||
|
<li> Attach a debugger to the application process and inspect </li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
For more information visit:
|
||||||
|
%s <a href="https://go.microsoft.com/fwlink/?linkid=808681"> <cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -20,6 +20,7 @@ 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;
|
||||||
|
HINSTANCE g_hOutOfProcessRHModule;
|
||||||
HINSTANCE g_hAspNetCoreModule;
|
HINSTANCE g_hAspNetCoreModule;
|
||||||
HANDLE g_hEventLog = NULL;
|
HANDLE g_hEventLog = NULL;
|
||||||
|
|
||||||
|
|
@ -223,6 +224,7 @@ BOOL APIENTRY DllMain(HMODULE hModule,
|
||||||
switch (ul_reason_for_call)
|
switch (ul_reason_for_call)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
g_hOutOfProcessRHModule = hModule;
|
||||||
DisableThreadLibraryCalls(hModule);
|
DisableThreadLibraryCalls(hModule);
|
||||||
InitializeSRWLock(&g_srwLockRH);
|
InitializeSRWLock(&g_srwLockRH);
|
||||||
DebugInitialize(hModule);
|
DebugInitialize(hModule);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
#include "forwardinghandler.h"
|
#include "forwardinghandler.h"
|
||||||
#include "url_utility.h"
|
#include "url_utility.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
|
#include "ServerErrorHandler.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
// Just to be aware of the FORWARDING_HANDLER object size.
|
// Just to be aware of the FORWARDING_HANDLER object size.
|
||||||
C_ASSERT(sizeof(FORWARDING_HANDLER) <= 632);
|
C_ASSERT(sizeof(FORWARDING_HANDLER) <= 632);
|
||||||
|
|
@ -16,7 +18,6 @@ C_ASSERT(sizeof(FORWARDING_HANDLER) <= 632);
|
||||||
#define FORWARDING_HANDLER_SIGNATURE ((DWORD)'FHLR')
|
#define FORWARDING_HANDLER_SIGNATURE ((DWORD)'FHLR')
|
||||||
#define FORWARDING_HANDLER_SIGNATURE_FREE ((DWORD)'fhlr')
|
#define FORWARDING_HANDLER_SIGNATURE_FREE ((DWORD)'fhlr')
|
||||||
|
|
||||||
STRA FORWARDING_HANDLER::sm_pStra502ErrorMsg;
|
|
||||||
ALLOC_CACHE_HANDLER * FORWARDING_HANDLER::sm_pAlloc = NULL;
|
ALLOC_CACHE_HANDLER * FORWARDING_HANDLER::sm_pAlloc = NULL;
|
||||||
TRACE_LOG * FORWARDING_HANDLER::sm_pTraceLog = NULL;
|
TRACE_LOG * FORWARDING_HANDLER::sm_pTraceLog = NULL;
|
||||||
PROTOCOL_CONFIG FORWARDING_HANDLER::sm_ProtocolConfig;
|
PROTOCOL_CONFIG FORWARDING_HANDLER::sm_ProtocolConfig;
|
||||||
|
|
@ -318,18 +319,8 @@ Failure:
|
||||||
}
|
}
|
||||||
else if (fFailedToStartKestrel && !m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage())
|
else if (fFailedToStartKestrel && !m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage())
|
||||||
{
|
{
|
||||||
HTTP_DATA_CHUNK DataChunk;
|
ServerErrorHandler handler(*m_pW3Context, 502, 5, "Bad Gateway", hr, g_hOutOfProcessRHModule, m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage(), OUT_OF_PROCESS_RH_STATIC_HTML);
|
||||||
pResponse->SetStatus(502, "Bad Gateway", 5, hr, NULL, TRUE);
|
handler.OnExecuteRequestHandler();
|
||||||
pResponse->SetHeader("Content-Type",
|
|
||||||
"text/html",
|
|
||||||
(USHORT)strlen("text/html"),
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
|
|
||||||
DataChunk.DataChunkType = HttpDataChunkFromMemory;
|
|
||||||
DataChunk.FromMemory.pBuffer = (PVOID)sm_pStra502ErrorMsg.QueryStr();
|
|
||||||
DataChunk.FromMemory.BufferLength = sm_pStra502ErrorMsg.QueryCB();
|
|
||||||
pResponse->WriteEntityChunkByReference(&DataChunk);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -728,31 +719,6 @@ HRESULT
|
||||||
sm_pTraceLog = CreateRefTraceLog(10000, 0);
|
sm_pTraceLog = CreateRefTraceLog(10000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_pStra502ErrorMsg.Copy(
|
|
||||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \
|
|
||||||
<html xmlns=\"http://www.w3.org/1999/xhtml\"> \
|
|
||||||
<head> \
|
|
||||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> \
|
|
||||||
<title> IIS 502.5 Error </title><style type=\"text/css\"></style></head> \
|
|
||||||
<body> <div id = \"content\"> \
|
|
||||||
<div class = \"content-container\"><h3> HTTP Error 502.5 - Process Failure </h3></div> \
|
|
||||||
<div class = \"content-container\"> \
|
|
||||||
<fieldset> <h4> Common causes of this issue: </h4> \
|
|
||||||
<ul><li> The application process failed to start </li> \
|
|
||||||
<li> The application process started but then stopped </li> \
|
|
||||||
<li> The application process started but failed to listen on the configured port </li></ul></fieldset> \
|
|
||||||
</div> \
|
|
||||||
<div class = \"content-container\"> \
|
|
||||||
<fieldset><h4> Troubleshooting steps: </h4> \
|
|
||||||
<ul><li> Check the system event log for error messages </li> \
|
|
||||||
<li> Enable logging the application process' stdout messages </li> \
|
|
||||||
<li> Attach a debugger to the application process and inspect </li></ul></fieldset> \
|
|
||||||
<fieldset><h4> For more information visit: \
|
|
||||||
<a href=\"https://go.microsoft.com/fwlink/?linkid=808681\"> <cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite></a></h4> \
|
|
||||||
</fieldset> \
|
|
||||||
</div> \
|
|
||||||
</div></body></html>");
|
|
||||||
|
|
||||||
Finished:
|
Finished:
|
||||||
if (FAILED_LOG(hr))
|
if (FAILED_LOG(hr))
|
||||||
{
|
{
|
||||||
|
|
@ -765,8 +731,6 @@ Finished:
|
||||||
VOID
|
VOID
|
||||||
FORWARDING_HANDLER::StaticTerminate()
|
FORWARDING_HANDLER::StaticTerminate()
|
||||||
{
|
{
|
||||||
sm_pStra502ErrorMsg.Reset();
|
|
||||||
|
|
||||||
if (sm_pResponseHeaderHash != NULL)
|
if (sm_pResponseHeaderHash != NULL)
|
||||||
{
|
{
|
||||||
sm_pResponseHeaderHash->Clear();
|
sm_pResponseHeaderHash->Clear();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern DWORD g_OptionalWinHttpFlags;
|
extern DWORD g_OptionalWinHttpFlags;
|
||||||
|
extern HINSTANCE g_hOutOfProcessRHModule;
|
||||||
extern HINSTANCE g_hWinHttpModule;
|
extern HINSTANCE g_hWinHttpModule;
|
||||||
extern HINSTANCE g_hAspNetCoreModule;
|
extern HINSTANCE g_hAspNetCoreModule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by HtmlResponses.rc
|
||||||
|
//
|
||||||
|
#define OUT_OF_PROCESS_RH_STATIC_HTML 101
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
@ -61,6 +61,77 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
||||||
WebConfigHelpers.AddOrModifyAspNetCoreSection("stdoutLogFile", Path.Combine(path, "std")));
|
WebConfigHelpers.AddOrModifyAspNetCoreSection("stdoutLogFile", Path.Combine(path, "std")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void EnableFreb(this IISDeploymentParameters deploymentParameters, string verbosity, string folderPath)
|
||||||
|
{
|
||||||
|
if (!deploymentParameters.PublishApplicationBeforeDeployment)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Testing freb requires site to be published.");
|
||||||
|
}
|
||||||
|
|
||||||
|
deploymentParameters.EnableModule("FailedRequestsTracingModule", "%IIS_BIN%\\iisfreb.dll");
|
||||||
|
|
||||||
|
// Set the TraceFailedRequestsSection to listend to ANCM events
|
||||||
|
deploymentParameters.ServerConfigActionList.Add(
|
||||||
|
(element, _) =>
|
||||||
|
{
|
||||||
|
var webServerElement = element
|
||||||
|
.RequiredElement("system.webServer");
|
||||||
|
|
||||||
|
var addElement = webServerElement
|
||||||
|
.GetOrAdd("tracing")
|
||||||
|
.GetOrAdd("traceFailedRequests")
|
||||||
|
.GetOrAdd("add");
|
||||||
|
|
||||||
|
addElement.SetAttributeValue("path", "*");
|
||||||
|
|
||||||
|
addElement.GetOrAdd("failureDefinitions")
|
||||||
|
.SetAttributeValue("statusCodes", "200-999");
|
||||||
|
|
||||||
|
var traceAreasElement = addElement
|
||||||
|
.GetOrAdd("traceAreas");
|
||||||
|
var innerAddElement = traceAreasElement.GetOrAdd("add", "provider", "WWW Server");
|
||||||
|
|
||||||
|
innerAddElement.SetAttributeValue("areas", "ANCM");
|
||||||
|
innerAddElement.SetAttributeValue("verbosity", verbosity);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the ANCM traceProviderDefinition to 65536
|
||||||
|
deploymentParameters.ServerConfigActionList.Add(
|
||||||
|
(element, _) =>
|
||||||
|
{
|
||||||
|
var webServerElement = element
|
||||||
|
.RequiredElement("system.webServer");
|
||||||
|
|
||||||
|
var traceProviderDefinitionsElement = webServerElement
|
||||||
|
.GetOrAdd("tracing")
|
||||||
|
.GetOrAdd("traceProviderDefinitions");
|
||||||
|
|
||||||
|
var innerAddElement = traceProviderDefinitionsElement.GetOrAdd("add", "name", "WWW Server");
|
||||||
|
|
||||||
|
innerAddElement.SetAttributeValue("name", "WWW Server");
|
||||||
|
innerAddElement.SetAttributeValue("guid", "{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}");
|
||||||
|
|
||||||
|
var areasElement = innerAddElement.GetOrAdd("areas");
|
||||||
|
var iae = areasElement.GetOrAdd("add", "name", "ANCM");
|
||||||
|
|
||||||
|
iae.SetAttributeValue("value", "65536");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the freb directory to the published app directory.
|
||||||
|
deploymentParameters.ServerConfigActionList.Add(
|
||||||
|
(element, contentRoot) =>
|
||||||
|
{
|
||||||
|
var traceFailedRequestsElement = element
|
||||||
|
.RequiredElement("system.applicationHost")
|
||||||
|
.Element("sites")
|
||||||
|
.Element("siteDefaults")
|
||||||
|
.Element("traceFailedRequestsLogging");
|
||||||
|
traceFailedRequestsElement.SetAttributeValue("directory", folderPath);
|
||||||
|
traceFailedRequestsElement.SetAttributeValue("enabled", "true");
|
||||||
|
traceFailedRequestsElement.SetAttributeValue("maxLogFileSizeKB", "1024");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void TransformPath(this IISDeploymentParameters parameters, Func<string, string, string> transformation)
|
public static void TransformPath(this IISDeploymentParameters parameters, Func<string, string, string> transformation)
|
||||||
{
|
{
|
||||||
parameters.WebConfigActionList.Add(
|
parameters.WebConfigActionList.Add(
|
||||||
|
|
@ -89,7 +160,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters.ServerConfigActionList.Add(
|
parameters.ServerConfigActionList.Add(
|
||||||
(element, _) => {
|
(element, _) =>
|
||||||
|
{
|
||||||
var webServerElement = element
|
var webServerElement = element
|
||||||
.RequiredElement("system.webServer");
|
.RequiredElement("system.webServer");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
{
|
||||||
|
[Collection(PublishedSitesCollection.Name)]
|
||||||
|
public class ClientDisconnectStressTests: FunctionalTestsBase
|
||||||
|
{
|
||||||
|
private readonly PublishedSitesFixture _fixture;
|
||||||
|
|
||||||
|
public ClientDisconnectStressTests(PublishedSitesFixture fixture)
|
||||||
|
{
|
||||||
|
_fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalTheory]
|
||||||
|
[InlineData(HostingModel.InProcess)]
|
||||||
|
[InlineData(HostingModel.OutOfProcess)]
|
||||||
|
public async Task ClientDisconnectStress(HostingModel hostingModel)
|
||||||
|
{
|
||||||
|
var site = await StartAsync(_fixture.GetBaseDeploymentParameters(hostingModel));
|
||||||
|
var maxRequestSize = 1000;
|
||||||
|
var blockSize = 40;
|
||||||
|
var random = new Random();
|
||||||
|
async Task RunRequests()
|
||||||
|
{
|
||||||
|
using (var connection = new TestConnection(site.HttpClient.BaseAddress.Port))
|
||||||
|
{
|
||||||
|
await connection.Send(
|
||||||
|
"POST /ReadAndFlushEcho HTTP/1.1",
|
||||||
|
$"Content-Length: {maxRequestSize}",
|
||||||
|
"Host: localhost",
|
||||||
|
"Connection: close",
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
|
||||||
|
var disconnectAfter = random.Next(maxRequestSize);
|
||||||
|
var data = new byte[blockSize];
|
||||||
|
for (int i = 0; i < disconnectAfter / blockSize; i++)
|
||||||
|
{
|
||||||
|
await connection.Stream.WriteAsync(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Task> tasks = new List<Task>();
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
tasks.Add(Task.Run(RunRequests));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
|
||||||
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
{
|
||||||
|
[Collection(PublishedSitesCollection.Name)]
|
||||||
|
public class FrebTests : LogFileTestBase
|
||||||
|
{
|
||||||
|
private readonly PublishedSitesFixture _fixture;
|
||||||
|
public FrebTests(PublishedSitesFixture fixture)
|
||||||
|
{
|
||||||
|
_fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ISet<string[]> FrebChecks()
|
||||||
|
{
|
||||||
|
var set = new HashSet<string[]>();
|
||||||
|
set.Add(new string[] { "ANCM_INPROC_EXECUTE_REQUEST_START" });
|
||||||
|
set.Add(new string[] { "ANCM_INPROC_EXECUTE_REQUEST_COMPLETION", "1" });
|
||||||
|
set.Add(new string[] { "ANCM_INPROC_ASYNC_COMPLETION_START" });
|
||||||
|
set.Add(new string[] { "ANCM_INPROC_ASYNC_COMPLETION_COMPLETION", "0" });
|
||||||
|
set.Add(new string[] { "ANCM_INPROC_MANAGED_REQUEST_COMPLETION" });
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[RequiresIIS(IISCapability.FailedRequestTracingModule)]
|
||||||
|
public async Task CheckCommonFrebEvents()
|
||||||
|
{
|
||||||
|
var result = await SetupFrebApp();
|
||||||
|
|
||||||
|
await result.HttpClient.GetAsync("HelloWorld");
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
foreach (var data in FrebChecks())
|
||||||
|
{
|
||||||
|
AssertFrebLogs(result, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[RequiresIIS(IISCapability.FailedRequestTracingModule)]
|
||||||
|
public async Task CheckFailedRequestEvents()
|
||||||
|
{
|
||||||
|
var result = await SetupFrebApp();
|
||||||
|
|
||||||
|
await result.HttpClient.GetAsync("Throw");
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
AssertFrebLogs(result, "ANCM_INPROC_ASYNC_COMPLETION_COMPLETION", "2");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[RequiresIIS(IISCapability.FailedRequestTracingModule)]
|
||||||
|
public async Task CheckFrebDisconnect()
|
||||||
|
{
|
||||||
|
var result = await SetupFrebApp();
|
||||||
|
|
||||||
|
using (var connection = new TestConnection(result.HttpClient.BaseAddress.Port))
|
||||||
|
{
|
||||||
|
await connection.Send(
|
||||||
|
"GET /WaitForAbort HTTP/1.1",
|
||||||
|
"Host: localhost",
|
||||||
|
"Connection: close",
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
await result.HttpClient.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() == "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
AssertFrebLogs(result, "ANCM_INPROC_REQUEST_DISCONNECT");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IISDeploymentResult> SetupFrebApp()
|
||||||
|
{
|
||||||
|
var parameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||||
|
parameters.EnableFreb("Verbose", _logFolderPath);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(_logFolderPath);
|
||||||
|
var result = await DeployAsync(parameters);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AssertFrebLogs(IISDeploymentResult result, params string[] data)
|
||||||
|
{
|
||||||
|
var folderPath = Helpers.GetFrebFolder(_logFolderPath, result);
|
||||||
|
var fileString = Directory.GetFiles(folderPath).Where(f => f.EndsWith("xml")).OrderBy(x => x).Last();
|
||||||
|
|
||||||
|
var xDocument = XDocument.Load(fileString).Root;
|
||||||
|
var nameSpace = (XNamespace)"http://schemas.microsoft.com/win/2004/08/events/event";
|
||||||
|
var elements = xDocument.Descendants(nameSpace + "Event");
|
||||||
|
var element = elements.Where(el => el.Descendants(nameSpace + "RenderingInfo").Single().Descendants(nameSpace + "Opcode").Single().Value == data[0]);
|
||||||
|
|
||||||
|
Assert.Single(element);
|
||||||
|
|
||||||
|
if (data.Length > 1)
|
||||||
|
{
|
||||||
|
var requestStatus = element.Single().Element(nameSpace + "EventData").Descendants().Where(el => el.Attribute("Name").Value == "requestStatus").Single();
|
||||||
|
Assert.Equal(data[1], requestStatus.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -63,6 +63,18 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetFrebFolder(string folder, IISDeploymentResult result)
|
||||||
|
{
|
||||||
|
if (result.DeploymentParameters.ServerType == ServerType.IISExpress)
|
||||||
|
{
|
||||||
|
return Path.Combine(folder, result.DeploymentParameters.SiteName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Path.Combine(folder, "W3SVC1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void CopyFiles(DirectoryInfo source, DirectoryInfo target, ILogger logger)
|
public static void CopyFiles(DirectoryInfo source, DirectoryInfo target, ILogger logger)
|
||||||
{
|
{
|
||||||
foreach (DirectoryInfo directoryInfo in source.GetDirectories())
|
foreach (DirectoryInfo directoryInfo in source.GetDirectories())
|
||||||
|
|
@ -113,6 +125,27 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task Retry(Func<Task> func, int attempts, int msDelay)
|
||||||
|
{
|
||||||
|
var exceptions = new List<Exception>();
|
||||||
|
|
||||||
|
for (var attempt = 0; attempt < attempts; attempt++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await func();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
exceptions.Add(e);
|
||||||
|
}
|
||||||
|
await Task.Delay(msDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new AggregateException(exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AssertWorkerProcessStop(this IISDeploymentResult deploymentResult, int? timeout = null)
|
public static void AssertWorkerProcessStop(this IISDeploymentResult deploymentResult, int? timeout = null)
|
||||||
{
|
{
|
||||||
var hostProcess = deploymentResult.HostProcess;
|
var hostProcess = deploymentResult.HostProcess;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
ShutdownToken = 8,
|
ShutdownToken = 8,
|
||||||
DynamicCompression = 16,
|
DynamicCompression = 16,
|
||||||
ApplicationInitialization = 32,
|
ApplicationInitialization = 32,
|
||||||
TracingModule = 64
|
TracingModule = 64,
|
||||||
|
FailedRequestTracingModule = 128
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
private static readonly bool _dynamicCompressionAvailable;
|
private static readonly bool _dynamicCompressionAvailable;
|
||||||
private static readonly bool _applicationInitializationModule;
|
private static readonly bool _applicationInitializationModule;
|
||||||
private static readonly bool _tracingModuleAvailable;
|
private static readonly bool _tracingModuleAvailable;
|
||||||
|
private static readonly bool _frebTracingModuleAvailable;
|
||||||
|
|
||||||
static RequiresIISAttribute()
|
static RequiresIISAttribute()
|
||||||
{
|
{
|
||||||
|
|
@ -90,6 +91,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
|
||||||
_tracingModuleAvailable = File.Exists(Path.Combine(Environment.SystemDirectory, "inetsrv", "iisetw.dll"));
|
_tracingModuleAvailable = File.Exists(Path.Combine(Environment.SystemDirectory, "inetsrv", "iisetw.dll"));
|
||||||
|
|
||||||
|
_frebTracingModuleAvailable = File.Exists(Path.Combine(Environment.SystemDirectory, "inetsrv", "iisfreb.dll"));
|
||||||
|
|
||||||
|
|
||||||
var iisRegistryKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\InetStp", writable: false);
|
var iisRegistryKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\InetStp", writable: false);
|
||||||
if (iisRegistryKey == null)
|
if (iisRegistryKey == null)
|
||||||
{
|
{
|
||||||
|
|
@ -161,12 +165,22 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (capabilities.HasFlag(IISCapability.TracingModule))
|
if (capabilities.HasFlag(IISCapability.TracingModule))
|
||||||
{
|
{
|
||||||
IsMet &= _tracingModuleAvailable;
|
IsMet &= _tracingModuleAvailable;
|
||||||
if (!_tracingModuleAvailable)
|
if (!_tracingModuleAvailable)
|
||||||
{
|
{
|
||||||
SkipReason += "The machine does not have IIS TracingModule installed.";
|
SkipReason += "The machine does not have IIS Failed Request Tracing Module installed.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (capabilities.HasFlag(IISCapability.FailedRequestTracingModule))
|
||||||
|
{
|
||||||
|
IsMet &= _frebTracingModuleAvailable;
|
||||||
|
if (!_frebTracingModuleAvailable)
|
||||||
|
{
|
||||||
|
SkipReason += "The machine does not have IIS Failed Request Tracing Module installed.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
|
||||||
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
{
|
||||||
|
[Collection(PublishedSitesCollection.Name)]
|
||||||
|
public class ErrorPagesTests : IISFunctionalTestBase
|
||||||
|
{
|
||||||
|
private readonly PublishedSitesFixture _fixture;
|
||||||
|
|
||||||
|
public ErrorPagesTests(PublishedSitesFixture fixture)
|
||||||
|
{
|
||||||
|
_fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
public async Task IncludesAdditionalErrorPageTextInProcessHandlerLoadFailure()
|
||||||
|
{
|
||||||
|
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||||
|
var response = await DeployAppWithStartupFailure(deploymentParameters);
|
||||||
|
|
||||||
|
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
Assert.Contains("HTTP Error 500.0 - ANCM In-Process Handler Load Failure", await response.Content.ReadAsStringAsync());
|
||||||
|
await AssertLink(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
public async Task IncludesAdditionalErrorPageTextOutOfProcessStartupFailure()
|
||||||
|
{
|
||||||
|
var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
|
||||||
|
var response = await DeployAppWithStartupFailure(deploymentParameters);
|
||||||
|
|
||||||
|
Assert.Equal(HttpStatusCode.BadGateway, response.StatusCode);
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
Assert.Contains("HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure", await response.Content.ReadAsStringAsync());
|
||||||
|
await AssertLink(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
public async Task IncludesAdditionalErrorPageTextOutOfProcessHandlerLoadFailure()
|
||||||
|
{
|
||||||
|
var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
|
||||||
|
deploymentParameters.HandlerSettings["handlerVersion"] = "88.93";
|
||||||
|
deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example";
|
||||||
|
|
||||||
|
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||||
|
var response = await deploymentResult.HttpClient.GetAsync("HelloWorld");
|
||||||
|
|
||||||
|
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
Assert.Contains("HTTP Error 500.0 - ANCM Out-Of-Process Handler Load Failure", await response.Content.ReadAsStringAsync());
|
||||||
|
await AssertLink(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
public async Task IncludesAdditionalErrorPageTextInProcessStartupFailure()
|
||||||
|
{
|
||||||
|
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||||
|
deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn");
|
||||||
|
deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example";
|
||||||
|
|
||||||
|
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||||
|
var response = await deploymentResult.HttpClient.GetAsync("HelloWorld");
|
||||||
|
|
||||||
|
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||||
|
|
||||||
|
StopServer();
|
||||||
|
|
||||||
|
Assert.Contains("HTTP Error 500.30 - ANCM In-Process Start Failure", await response.Content.ReadAsStringAsync());
|
||||||
|
await AssertLink(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task AssertLink(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
Assert.Contains("<a href=\"http://example\"> <cite> http://example </cite></a> and ", await response.Content.ReadAsStringAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HttpResponseMessage> DeployAppWithStartupFailure(IISDeploymentParameters deploymentParameters)
|
||||||
|
{
|
||||||
|
deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", "doesnot"));
|
||||||
|
deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("arguments", "start"));
|
||||||
|
|
||||||
|
deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example";
|
||||||
|
|
||||||
|
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||||
|
|
||||||
|
return await deploymentResult.HttpClient.GetAsync("HelloWorld");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
|
||||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, $@"Application '{Regex.Escape(deploymentResult.ContentRoot)}\\' wasn't able to start. {subError}");
|
EventLogHelpers.VerifyEventLogEvent(deploymentResult, $@"Application '{Regex.Escape(deploymentResult.ContentRoot)}\\' wasn't able to start. {subError}");
|
||||||
|
|
||||||
Assert.Contains("HTTP Error 500.0 - ANCM InProcess Startup Failure", await response.Content.ReadAsStringAsync());
|
Assert.Contains("HTTP Error 500.0 - ANCM In-Process Handler Load Failure", await response.Content.ReadAsStringAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[ConditionalFact]
|
||||||
|
|
@ -456,7 +456,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
{
|
{
|
||||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||||
Assert.Contains("HTTP Error 500.0 - ANCM InProcess Startup Failure", await response.Content.ReadAsStringAsync());
|
Assert.Contains("HTTP Error 500.0 - ANCM In-Process Handler Load Failure", await response.Content.ReadAsStringAsync());
|
||||||
StopServer();
|
StopServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
var response = await deploymentResult.HttpClient.GetAsync(_helloWorldRequest);
|
var response = await deploymentResult.HttpClient.GetAsync(_helloWorldRequest);
|
||||||
Assert.False(response.IsSuccessStatusCode);
|
Assert.False(response.IsSuccessStatusCode);
|
||||||
var responseString = await response.Content.ReadAsStringAsync();
|
var responseString = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Contains("HTTP Error 500.0 - ANCM OutOfProcess Startup Failure", responseString);
|
Assert.Contains("HTTP Error 500.0 - ANCM Out-Of-Process Handler Load Failure", responseString);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
// ANCM v2 does retry on port collisions, so no retries should be required.
|
// ANCM v2 does retry on port collisions, so no retries should be required.
|
||||||
var attempts = (ancmVersion == AncmVersion.AspNetCoreModule) ? 2 : 1;
|
var attempts = (ancmVersion == AncmVersion.AspNetCoreModule) ? 2 : 1;
|
||||||
|
|
||||||
return Retry(async () =>
|
return Helpers.Retry(async () =>
|
||||||
{
|
{
|
||||||
const int numApps = 10;
|
const int numApps = 10;
|
||||||
|
|
||||||
|
|
@ -75,27 +75,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attempts: attempts);
|
attempts: attempts, msDelay: 0);
|
||||||
}
|
|
||||||
|
|
||||||
private async Task Retry(Func<Task> func, int attempts)
|
|
||||||
{
|
|
||||||
var exceptions = new List<Exception>();
|
|
||||||
|
|
||||||
for (var attempt = 0; attempt < attempts; attempt++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await func();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
exceptions.Add(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new AggregateException(exceptions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,6 +324,17 @@ namespace TestSite
|
||||||
result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
|
result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private async Task ReadAndFlushEcho(HttpContext ctx)
|
||||||
|
{
|
||||||
|
var readBuffer = new byte[4096];
|
||||||
|
var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
|
||||||
|
while (result != 0)
|
||||||
|
{
|
||||||
|
await ctx.Response.WriteAsync(Encoding.UTF8.GetString(readBuffer, 0, result));
|
||||||
|
await ctx.Response.Body.FlushAsync();
|
||||||
|
result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ReadAndWriteEchoLines(HttpContext ctx)
|
private async Task ReadAndWriteEchoLines(HttpContext ctx)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ if (!(Test-Path $cdb))
|
||||||
|
|
||||||
if ($Mode -eq "Setup")
|
if ($Mode -eq "Setup")
|
||||||
{
|
{
|
||||||
|
Move-Item $env:windir\System32\vsjitdebugger.exe $env:windir\System32\_vsjitdebugger.exe;
|
||||||
|
|
||||||
Setup-appverif w3wp.exe
|
Setup-appverif w3wp.exe
|
||||||
Setup-appverif iisexpress.exe
|
Setup-appverif iisexpress.exe
|
||||||
|
|
||||||
|
|
@ -70,6 +72,8 @@ if ($Mode -eq "Setup")
|
||||||
New-Item -Path $werHive -Name LocalDumps
|
New-Item -Path $werHive -Name LocalDumps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
New-ItemProperty $werHive -Name "DontShowUI" -Value 1 -PropertyType "DWORD" -Force;
|
||||||
|
|
||||||
New-ItemProperty $ldHive -Name "DumpFolder" -Value $DumpFolder -PropertyType "ExpandString" -Force;
|
New-ItemProperty $ldHive -Name "DumpFolder" -Value $DumpFolder -PropertyType "ExpandString" -Force;
|
||||||
New-ItemProperty $ldHive -Name "DumpCount" -Value 15 -PropertyType "DWORD" -Force;
|
New-ItemProperty $ldHive -Name "DumpCount" -Value 15 -PropertyType "DWORD" -Force;
|
||||||
New-ItemProperty $ldHive -Name "DumpType" -Value 2 -PropertyType "DWORD" -Force;
|
New-ItemProperty $ldHive -Name "DumpType" -Value 2 -PropertyType "DWORD" -Force;
|
||||||
|
|
@ -79,8 +83,12 @@ if ($Mode -eq "Setup")
|
||||||
|
|
||||||
if ($Mode -eq "Shutdown")
|
if ($Mode -eq "Shutdown")
|
||||||
{
|
{
|
||||||
|
Move-Item $env:windir\System32\_vsjitdebugger.exe $env:windir\System32\vsjitdebugger.exe;
|
||||||
|
|
||||||
Remove-Item $ldHive -Recurse -Force
|
Remove-Item $ldHive -Recurse -Force
|
||||||
|
|
||||||
|
New-ItemProperty $werHive -Name "DontShowUI" -Value 0 -PropertyType "DWORD" -Force;
|
||||||
|
|
||||||
Shutdown-appverif w3wp.exe
|
Shutdown-appverif w3wp.exe
|
||||||
Shutdown-appverif iisexpress.exe
|
Shutdown-appverif iisexpress.exe
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue