Modernize startup error pages (#1476)
This commit is contained in:
parent
f2fbd803b9
commit
7a09638afe
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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 "";
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue