Comparing Native-Code and Managed-Code Notifications

IIS 7.0
 

Although the integrated request-processing pipeline in the IIS 7 Web server core enables native-code developers to write HTTP modules in C++, the event notifications that are available to native-code and managed-code developers are not identical. Developers who are migrating an HTTP module from a managed language such as C# to native code will have to address these differences when they create their new modules.

With IIS 7, developers can now create native-code HTTP modules that process notifications at the global level. In previous versions of IIS, developers could create HTTP modules that processed notifications at only the request-level. HTTP modules that process notifications at the global level are used to process notifications for a variety of server-level events.

The following table lists the global notification methods that are available to native-code developers.

Event notification methodDescription
OnGlobalApplicationResolveModulesCalled when IIS resolves the registered modules.
OnGlobalApplicationStartCalled when IIS starts an application.
OnGlobalApplicationStopCalled when IIS exits an application.
OnGlobalCacheCleanupCalled when IIS clears the cache.
OnGlobalCacheOperationCalled when IIS performs a cache-related operation.
OnGlobalConfigurationChangeCalled when a change is made to a configuration file.
OnGlobalCustomNotificationCalled when a module raises a user-defined notification.
OnGlobalFileChangeCalled when a file within a Web site is changed.
OnGlobalHealthCheckCalled when a health-related operation is executed.
OnGlobalPreBeginRequestCalled before a request enters the integrated request-processing pipeline.
OnGlobalRSCAQueryCalled when a Run-Time Status and Control query is executed.
OnGlobalStopListeningCalled when IIS stops accepting new requests.
OnGlobalThreadCleanupCalled when IIS returns a thread to the thread pool.
OnGlobalTraceEventCalled when a trace event is raised.

Although request notification methods for native-code and managed-code HTTP modules are similar in many ways, they are not completely analogous. For example, the list of deterministic request notification methods is nearly identical for native-code and managed-code modules, yet the list of nondeterministic request notification methods differs greatly.

Native-Code Deterministic Request Notifications

The following table lists the deterministic request notification methods that are available to native-code developers.

Event notification methodPost-event notification method
OnBeginRequestOnPostBeginRequest
OnAuthenticateRequestOnPostAuthenticateRequest
OnAuthorizeRequestOnPostAuthorizeRequest
OnResolveRequestCacheOnPostResolveRequestCache
OnMapRequestHandlerOnPostMapRequestHandler
OnAcquireRequestStateOnPostAcquireRequestState
OnPreExecuteRequestHandlerOnPostPreExecuteRequestHandler
OnExecuteRequestHandlerOnPostExecuteRequestHandler
OnReleaseRequestStateOnPostReleaseRequestState
OnUpdateRequestCacheOnPostUpdateRequestCache
OnLogRequestOnPostLogRequest
OnEndRequestOnPostEndRequest

Managed-Code Deterministic Request Notifications

The following table lists the deterministic request notification methods that are available to managed-code developers.

Event notification methodPost-event notification method
BeginRequest(None)
AuthenticateRequestPostAuthenticateRequest
AuthorizeRequestPostAuthorizeRequest
ResolveRequestCachePostResolveRequestCache
MapRequestHandlerPostMapRequestHandler
AcquireRequestStatePostAcquireRequestState
PreRequestHandlerExecute(None)
RequestHandlerExecutePostRequestHandlerExecute
ReleaseRequestStatePostReleaseRequestState
UpdateRequestCachePostUpdateRequestCache
LogRequestPostLogRequest
EndRequest(None)

Native-Code Nondeterministic Request Notifications

The following table lists the nondeterministic request notification methods that are available to native-code developers.

Event notification methodPost-event notification method
OnAsyncCompletion(None)
OnCustomRequestNotification(None)
OnMapPath(None)
OnReadEntity(None)
OnSendResponse(None)

Managed-Code Nondeterministic Request Notifications

The following table lists the nondeterministic request notification methods that are available to managed-code developers.

Event notification methodPost-event notification method
PreSendRequestHeaders(None)
PreSendRequestContent(None)

Creating Native-Code HTTP Modules
Designing Native-Code HTTP Modules

Show: