다음을 통해 공유


REQUEST_NOTIFICATION_STATUS 열거형

요청 수준 알림의 반환 값을 정의합니다.

구문

typedef enum REQUEST_NOTIFICATION_STATUS{  
   RQ_NOTIFICATION_CONTINUE,  
   RQ_NOTIFICATION_PENDING,  
   RQ_NOTIFICATION_FINISH_REQUEST  
};  

멤버

멤버 이름 설명
RQ_NOTIFICATION_CONTINUE IIS가 추가 요청 수준 알림을 계속 처리해야 임을 나타냅니다.
RQ_NOTIFICATION_PENDING 비동기 알림이 보류 중임을 나타내고 IIS에 요청 수준 처리를 반환합니다.
RQ_NOTIFICATION_FINISH_REQUEST IIS가 요청 수준 알림 처리를 완료했으며 추가 요청 수준 알림을 처리해서는 안 됨을 나타냅니다.

설명

열거형의 REQUEST_NOTIFICATION_STATUS 멤버는 요청 수준 알림의 반환 값으로 사용되며 멤버는 통합 요청 처리 파이프라인 내에서 프로세스 흐름을 제어하는 데 도움이 됩니다. 예를 들어 요청 수준 알림 처리기에서 반환하면 RQ_NOTIFICATION_CONTINUE IIS가 추가 요청 수준 알림을 계속 처리하도록 지시하는 반면, 요청 수준 알림 처리기에서 반환 RQ_NOTIFICATION_FINISH_REQUEST 하면 요청 수준 처리가 완료되었으며 IIS가 추가 요청 수준 알림을 처리해서는 안 된다는 것을 IIS에 알릴 수 있습니다. 요청 처리를 구현하는 모듈은 오류가 발생할 때 를 반환 RQ_NOTIFICATION_FINISH_REQUEST 해야 합니다.

예제

다음 예제에서는 처리기를 RQ_BEGIN_REQUEST 구현합니다. 요청이 HTML 파일이 아니면 예제가 반환 RQ_NOTIFICATION_CONTINUE 되고 정상적인 처리가 발생합니다. 카운터 값에 나머지가 0이면 요청된 파일이 IHttpResponse::WriteEntityChunkByReference 메서드에서 반환된 문자열로 대체되고 예제에서는 를 반환합니다 RQ_NOTIFICATION_FINISH_REQUEST. 오류가 발생하면 예제에서 오류를 기록하고 를 반환합니다 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;
}

요구 사항

형식 Description
클라이언트 - Windows Vista의 IIS 7.0
- Windows 7의 IIS 7.5
- Windows 8의 IIS 8.0
- WINDOWS 10 IIS 10.0
서버 - Windows Server 2008의 IIS 7.0
- Windows Server 2008 R2의 IIS 7.5
- Windows Server 2012의 IIS 8.0
- Windows Server 2012 R2의 IIS 8.5
- WINDOWS SERVER 2016 IIS 10.0
제품 - 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
헤더 Httpserv.h

참고 항목

Web Server Core 열거형
GLOBAL_NOTIFICATION_STATUS 열거형