Reserving URL Namespaces by Using Http.sys

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

You can explicitly reserve a URL namespace in HTTP.SYS, and then use this namespace to create HTTP endpoints. To do this, you must understand the concept of explicit and implicit namespace reservation and how SQL Server registers an HTTP endpoint with HTTP.SYS.

Explicit vs. Implicit Namespace Reservation

When a user executes a CREATE ENDPOINT statement, such as the following:

CREATE ENDPOINT sql_endpoint 
   STATE = STARTED
AS HTTP (
   PATH = '/sql/AdvWorks', 
   AUTHENTICATION = (INTEGRATED ), 
   PORTS = ( CLEAR ), 
   SITE = 'MyServer'
)
FOR SOAP (
    ...
)
Go

The namespace http://MyServer:80/sql/AdvWorks is implicitly reserved in HTTP.SYS. This means that while the SQL Server-based application is running, any HTTP requests to this endpoint are forwarded to the instance of SQL Server. However, this namespace can be taken by other applications if the instance of SQL Server is not running.

When you explicitly reserve a namespace, the namespace is reserved specifically for SQL Server, and all HTTP requests to this endpoint are forwarded to the instance of SQL Server. For more information, see Reserving an HTTP Namespace.

Note

Visual Studio 2005 and Http.sys follow different URL canonicalization rules. For example, Http.sys can accept an inclusive wildcard, such as "/SQL/Mypath/...", specified as part of the PATH setting when an endpoint is created. However, Visual Studio 2005 has stricter canonicalization rules and trims the "..." information before transmitting the URL.

How SQL Server Registers the Endpoint

To manage HTTP endpoints, you use CREATE ENDPOINT, ALTER ENDPOINT and DROP ENDPOINT. You must have the required permissions to create, modify, or drop an endpoint. This is described in the topic, GRANT Endpoint Permissions (Transact-SQL).

When you execute CREATE ENDPOINT to create an endpoint, SQL Server runs the statement and registers the endpoint with the HTTP.SYS. Depending on the context in which the endpoint statement is specified, SQL Server impersonates the caller as follows:

  • If you execute the statement in the context of a Windows account, SQL Server impersonates the caller to register the endpoint with HTTP.SYS.

  • If you execute the statement in the context of a SQL Server account, for example, sa or some other SQL Server login, SQL Server impersonates the caller by using the SQL Server account, specified when SQL Server is installed, to register the endpoint with HTTP.SYS.

Both the Windows account and the SQL Server account that SQL Server impersonates must have local Windows administrator privileges for the HTTP endpoint registration to succeed.

Verifying HTTP Namespace Reservations

To determine what namespaces are reserved in HTTP.SYS, you run the HTTP configuration utility, Httpcfg.exe, at the command prompt.

Note

Httpcfg.exe is installed as part of the Windows Server Support tools. For more information, see Configuring the HTTP Kernel-Mode Driver (Http.sys).

The following is an example of using Httpcfg.exe to return the list of reserved HTTP namespaces:

httpcfg query urlacl

This command will display a list of all existing namespace reservations, returning the namespace URL and account under which it was reserved.

Here is typical output for this command:

URL: http://adventure-works.com:80/sql/
ACL : D:(A;;GA;;;S-1-5-21-123456789-1234567890-1262470759-1010)
-----------------------------------------------------------------
URL : https://adventure-works.com:443/sql/
ACL : D:(A;;GA;;;NS)
-----------------------------------------------------------------

Note

This procedure can only be executed by members of the sysadmin role and requires the impersonation account to have administrator privileges on the computer.