Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsAbortServiceProxy function

Aborts the service proxy, and cancels any pending I/O on the service proxy.


HRESULT WINAPI  WsAbortServiceProxy(
  _In_     WS_SERVICE_PROXY* serviceProxy,
  _In_opt_ WS_ERROR*         error


serviceProxy [in]

Pointer to a WS_SERVICE_PROXY structure representing the service proxy to abort.

error [in, optional]

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 codeDescription

One or more arguments are invalid.



WsAbortServiceProxy shows the following behavior depending on the state of service proxy (see the WS_SERVICE_PROXY_STATE enumeration for possible states):

  • If the service proxy is opening and in the WS_SERVICE_PROXY_STATE_OPENING state, you can call WsAbortServiceProxy to abort the opening operation. The service proxy will cancel all pending I/O and transition back to WS_SERVICE_PROXY_STATE_CREATED state.
  • If the service proxy is already open and in the WS_SERVICE_PROXY_STATE_OPEN state, WsAbortServiceProxy will cause the service proxy to abort all underlying channels and transition to the WS_SERVICE_PROXY_STATE_FAULTED state. Once the abort is initiated, the service proxy will not accept any new calls. The application can call WsCloseServiceProxy to close it
  • If the service proxy is closing and in the WS_SERVICE_PROXY_STATE_CLOSING state, all underlying channels are aborted, and the service proxy tansitions to the WS_SERVICE_PROXY_STATE_CLOSED state.

For an example of using this function, see ServiceCancellationExample.


Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft