WsAbortServiceHost function (webservices.h)

Aborts all current operations on the specified service host.


HRESULT WsAbortServiceHost(
  [in]           WS_SERVICE_HOST *serviceHost,
  [in, optional] WS_ERROR        *error


[in] serviceHost

Pointer to a WS_SERVICE_HOST structure representing the service host on which to abort operations.

[in, optional] error

Pointer to a WS_ERROR structure that receives additional error information if the function fails.

Return value

If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.

Return code Description
One or more arguments are invalid.


WsAbortServiceHost aborts all listeners on the service host, and as a result, no new channels are accepted from the client. All channels currently being used by the service host to service messages are aborted as well.

If a call is pending and it has a cancel callback registered through the WsRegisterOperationForCancel function, the callback is called. However, the runtime still waits for the call to complete.

For more information on registering for cancellation notification, see WsRegisterOperationForCancel.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll