Export (0) Print
Expand All

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 Value

Type: System.Boolean
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 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

© 2015 Microsoft