Oharra
Baimena behar duzu orria atzitzeko. Direktorioetan saioa has dezakezu edo haiek alda ditzakezu.
Baimena behar duzu orria atzitzeko. Direktorioak alda ditzakezu.
Define los valores devueltos para las notificaciones de nivel de solicitud.
Sintaxis
typedef enum REQUEST_NOTIFICATION_STATUS{
RQ_NOTIFICATION_CONTINUE,
RQ_NOTIFICATION_PENDING,
RQ_NOTIFICATION_FINISH_REQUEST
};
Miembros
| Nombre del miembro | Descripción |
|---|---|
RQ_NOTIFICATION_CONTINUE |
Indica que IIS debe seguir procesando notificaciones de nivel de solicitud adicionales. |
RQ_NOTIFICATION_PENDING |
Indica que una notificación asincrónica está pendiente y devuelve el procesamiento de nivel de solicitud a IIS. |
RQ_NOTIFICATION_FINISH_REQUEST |
Indica que IIS ha terminado de procesar las notificaciones de nivel de solicitud y no debe procesar notificaciones de nivel de solicitud adicionales. |
Comentarios
Los miembros de la REQUEST_NOTIFICATION_STATUS enumeración se usan como valores devueltos de las notificaciones de nivel de solicitud y los miembros ayudan a controlar el flujo de proceso dentro de la canalización integrada de procesamiento de solicitudes. Por ejemplo, la devolución RQ_NOTIFICATION_CONTINUE de un controlador de notificaciones de nivel de solicitud indica a IIS que siga procesando notificaciones de nivel de solicitud adicionales, mientras que la devolución RQ_NOTIFICATION_FINISH_REQUEST de un controlador de notificaciones de nivel de solicitud informa a IIS de que el procesamiento de nivel de solicitud está completo y IIS no debe procesar notificaciones de nivel de solicitud adicionales. Los módulos que implementan el control de solicitudes deben devolverse RQ_NOTIFICATION_FINISH_REQUEST cuando se produce un error.
Ejemplo
En el ejemplo siguiente se implementa un RQ_BEGIN_REQUEST controlador. Si la solicitud no es un archivo HTML, el ejemplo devuelve RQ_NOTIFICATION_CONTINUE y se produce el procesamiento normal. Cuando el valor del contador tiene un resto cero, el archivo solicitado se reemplaza por una cadena devuelta por el método IHttpResponse::WriteEntityChunkByReference y el ejemplo devuelve RQ_NOTIFICATION_FINISH_REQUEST. Si se produce un error, el ejemplo registra el error y devuelve RQ_NOTIFICATION_FINISH_REQUEST.
REQUEST_NOTIFICATION_STATUS
CMyHttpModule::OnBeginRequest(
IHttpContext* pHttpContext,
IHttpEventProvider* pProvider
)
{
HRESULT hr;
static long cnt;
InterlockedIncrement(&cnt); // keep track of how many times we are called
cnt++;
IHttpRequest *pRequest = pHttpContext->GetRequest();
PCWSTR url = pRequest->GetRawHttpRequest()->CookedUrl.pAbsPath;
OutputDebugStringW(url);
// return unless requesting a HTML file
if (!wcsstr(url, L".htm"))
return RQ_NOTIFICATION_CONTINUE;
IHttpResponse * pHttpResponse = pHttpContext->GetResponse();
// Return most times so we can still view content
if ((cnt % 5) || pHttpResponse == NULL)
return RQ_NOTIFICATION_CONTINUE;
TRC_MSG_FULL("HTML cnt = " << cnt);
static int insertPosCnt;
int insertPos = ++insertPosCnt % 2 - 1; // toggle between 0 and -1
// Use ostringstream to create some dynamic content
std::ostringstream os;
os << "<p /> first chunk callback count = " << cnt
<< " insertPos = " << insertPos << "<br />";
//
// WECbyRefChunk does all the work of inserting data into the response
//
hr = WECbyRefChunk(os, pHttpContext, pProvider, insertPos);
if (FAILED(hr))
return RQ_NOTIFICATION_FINISH_REQUEST;
os << "<br /> <b> Adding 2nd chunk in Bold </b> File insertPos = " << insertPos;
hr = WECbyRefChunk(os, pHttpContext, pProvider, insertPos);
if (FAILED(hr))
return RQ_NOTIFICATION_FINISH_REQUEST;
os << " <p /> Last (3rd) Chunk added with default append chunk GetCurrentThreadId = "
<< GetCurrentThreadId();
// any errors will be logged/handled in WECbyRefChunk
WECbyRefChunk(os, pHttpContext, pProvider);
// End additional processing, not because of error, but so another request
// (from a GIF or .css style sheet on the same HTML page)
// doesn't wipe out our WriteEntityChunkByReference. We can also get the
// WriteEntityChunkByReference prepended to our normal HTML page.
return RQ_NOTIFICATION_FINISH_REQUEST;
}
HRESULT hr = S_OK;
IHttpTraceContext * pTraceContext = pHttpContext->GetTraceContext();
hr = My_Events::My_COMPLETION::RaiseEvent(pTraceContext, InsertPosition);
if (FAILED(hr)) {
LOG_ERR_HR(hr, "RaiseEvent");
return hr;
}
Requisitos
| Tipo | Descripción |
|---|---|
| Remoto | - IIS 7.0 en Windows Vista - IIS 7.5 en Windows 7 - IIS 8.0 en Windows 8 - IIS 10.0 en Windows 10 |
| Servidor | - IIS 7.0 en Windows Server 2008 - IIS 7.5 en Windows Server 2008 R2 - IIS 8.0 en Windows Server 2012 - IIS 8.5 en Windows Server 2012 R2 - IIS 10.0 en Windows Server 2016 |
| Producto | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 - IIS Express 7.5, IIS Express 8.0, IIS Express 10.0 |
| Encabezado | Httpserv.h |
Consulte también
Enumeraciones de Web Server Core
GLOBAL_NOTIFICATION_STATUS (enumeración)