This documentation is archived and is not being maintained.

ServiceMetadataBehavior.HttpGetEnabled Property

Gets or sets a value that indicates whether to publish service metadata for retrieval using an HTTP/GET request.

Namespace: System.ServiceModel.Description
Assembly: System.ServiceModel (in system.servicemodel.dll)

public bool HttpGetEnabled { get; set; }
/** @property */
public boolean get_HttpGetEnabled ()

/** @property */
public void set_HttpGetEnabled (boolean value)

public function get HttpGetEnabled () : boolean

public function set HttpGetEnabled (value : boolean)

Not applicable.

Property Value

true if the WSDL is published; otherwise, false. The default is false.

If the value of HttpGetUrl is relative, the address at which the metadata is published is the base address and the service address plus a ?wsdl querystring.

If the value of HttpGetUrl is absolute the address at which the metadata is published is the value of HttpGetUrl value plus a ?wsdl querystring.

For example, if the service address is http://localhost:8080/CalculatorService and the HttpGetUrl is an empty string, the HTTP/GET metadata address is http://localhost:8080/CalculatorService?wsdl.

If you do not enable this property and do not change HttpGetUrl or set it to a relative address, an exception is thrown at runtime when the service host is opened without a base address for HTTP.

The following code example demonstrates the use of ServiceMetadataBehavior in a configuration file to enable metadata support for HTTP/GET and WS-Transfer/GET requests.

            <add baseAddress="http://localhost:8080/SampleService" />
        <!-- Adds a WS-MetadataExchange endpoint at -->
        <!-- "http://localhost:8080/SampleService/mex" -->
      <behavior name="metadataSupport">
        <!-- Enables the IMetadataExchange endpoint in services that -->
        <!-- use "metadataSupport" in their behaviorConfiguration attribute. -->
        <!-- In addition, the httpGetEnabled and httpGetUrl attributes publish -->
        <!-- Service metadata for retrieval by HTTP/GET at the address -->
        <!-- "http://localhost:8080/SampleService?wsdl" -->
        <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0