UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NC:webservices.WS_SERVICE_CLOSE_CHANNEL_CALLBACK |
WS_SERVICE_CLOSE_CHANNEL_CALLBACK (webservices.h) |
Invoked when a channel is closed or aborted on an endpoint. |
|
wsw\ws_service_close_channel_callback.htm |
wsw |
e2860015-219b-46be-921d-7ced0d95fc60 |
12/05/2018 |
WS_SERVICE_CLOSE_CHANNEL_CALLBACK, WS_SERVICE_CLOSE_CHANNEL_CALLBACK callback, WS_SERVICE_CLOSE_CHANNEL_CALLBACK callback function [Web Services for Windows], webservices/WS_SERVICE_CLOSE_CHANNEL_CALLBACK, wsw.ws_service_close_channel_callback |
webservices.h |
Windows |
Windows 7 [desktop apps only] |
Windows Server 2008 R2 [desktop apps only] |
Windows |
19H1 |
|
|
|
|
|
|
Invoked when a channel is closed or aborted on an endpoint. This callback is called right before we are about to close the channel.
For normal operation when service host is running and the client cleanly closed the channel, this implies that we have received a session closure from the client and we are about to close the channel.
The other scenario is when service host is going through an Abort Shutdown or during the processing of the message an unrecoverable error condition is met, as a result of this we attempt to abort and then close the channel. In this case as well right before the abort we will call upon this callback.
For session-based service contract, this notification signifies session tear down. Thus an application state scoped for the session can be destroyed within this callback.
The operation context.
Information on whether the function is getting invoked asynchronously.
This callback function does not return a value.
The returned HRESULT is only used to see if the function is completing asynchronously. Failure or reporting failure through HRESULT does not in any way affects the service host infrastructure.
Irrespective of whether WS_SERVICE_ACCEPT_CHANNEL_CALLBACK competed successfully or not. This function will always be fired.
See also WS_SERVICE_ACCEPT_CHANNEL_CALLBACK which can be used by the application to associate state, and gets called when a channel gets accepted.
For an example implementation on how to use this callback for disassociating session state, see the session based calculator sample.
This callback is cancellable.
HRESULT CALLBACK FreeSessionCalculator (const WS_OPERATION_CONTEXT* context,
const WS_ASYNC_CONTEXT* asyncContext)
{
HRESULT hr = NOERROR;
SessionfulCalculator* calculator = NULL;
hr = WsGetOperationContextProperty (context,
WS_OPERATION_CONTEXT_PROPERTY_CHANNEL_USER_STATE,
&calculator, sizeof (SessionfulCalculator*), NULL);
if (SUCCEEDED(hr) && (calculator != NULL))
{
delete calculator;
}
return NOERROR;
}