HttpCreateServerSession function (http.h)

The HttpCreateServerSession function creates a server session for the specified version.


HTTPAPI_LINKAGE ULONG HttpCreateServerSession(
  [in]  HTTPAPI_VERSION         Version,
  [out] PHTTP_SERVER_SESSION_ID ServerSessionId,
  [in]  ULONG                   Reserved


[in] Version

An HTTPAPI_VERSION structure that indicates the version of the server session. For version 2.0, declare an instance of the structure and set it to the predefined value HTTPAPI_VERSION_2 before passing it to HttpCreateServerSession.

The version must be 2.0; HttpCreateServerSession does not support version 1.0 request queues.

[out] ServerSessionId

A pointer to the variable that receives the ID of the server session.

[in] Reserved

Reserved. Must be zero.

Return value

If the function succeeds, it returns NO_ERROR.

If the function fails, it returns one of the following error codes.

Value Meaning
The version passed is invalid or unsupported.
The pServerSessionId parameter is null or the Reserved is non zero.


Server sessions own a set of URL Groups. They are top-level configuration containers for configuration information that applies to all of the URL Groups created under them. For more information about configuring a server session, see HttpSetServerSessionProperty.

The HTTP Server API does not support asynchronous I/O for server sessions.

When the server session is no longer required, or before the application terminates, application must delete the server session by calling HttpCloseServerSession. When a server session is deleted all of the associated URL Groups are also automatically deleted.


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header http.h
Library Httpapi.lib
DLL Httpapi.dll

See also

HTTP Server API Version 2.0 Functions