WsCreateServiceHost function (webservices.h)

Creates a service host for the specified endpoints.


HRESULT WsCreateServiceHost(
                 const WS_SERVICE_ENDPOINT **endpoints,
  [in]           const USHORT              endpointCount,
                 const WS_SERVICE_PROPERTY *serviceProperties,
  [in]           ULONG                     servicePropertyCount,
                 WS_SERVICE_HOST           **serviceHost,
  [in, optional] WS_ERROR                  *error



An array of WS_SERVICE_ENDPOINT structures representing the service endpoints for which to create the service host.

[in] endpointCount

The number of endpoints in the endpoints array.


An array of WS_SERVICE_PROPERTY structures containing optional properties for the service host.

The value of this parameter may be NULL, in which case, the servicePropertyCount parameter must be 0 (zero).

[in] servicePropertyCount

The number of properties in the serviceProperties array.


On success, a pointer that receives the address of the WS_SERVICE_HOST structure representing the new service host.

When you no longer need this structure, you must free it by calling WsFreeServiceHost.

[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
An invalid argument is specified for creating the service host.
A quota was exceeded.
Insufficient memory to complete the operation.
Other Errors
This function may return other errors not listed above.


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