How to: Use Svcutil.exe to Download Metadata Documents

You can use Svcutil.exe to download metadata from running services and
to save the metadata to local files. For HTTP and HTTPS URL schemes,
Svcutil.exe attempts to retrieve metadata using WS-MetadataExchange
and XML Web Service Discovery. For all other URL schemes, Svcutil.exe
uses only WS-MetadataExchange.

By default, Svcutil.exe uses the bindings defined in the
MetadataExchangeBindings class. To configure the binding used for
WS-MetadataExchange, you must define a client endpoint in the
configuration file for Svcutil.exe (svcutil.exe.config) that uses the
IMetadataExchange contract and that has the same name as the Uniform
Resource Identifier (URI) scheme of the metadata endpoint address.

To download metadata using Svcutil.exe
Locate the Svcutil.exe tool at the following location:

C:\Program Files\Microsoft SDKs\Windows\v1.0.\bin

At the command prompt, launch the tool using the following format.

svcutil.exe /t:metadata <url>* | <epr>


You must specify the /t:metadata option to download metadata.
Otherwise, client code and configuration are generated.

The <url> argument specifies the URL to a service endpoint that
provides metadata or to a metadata document hosted online. The <epr>
argument specifies the path to an XML file that contains a
WS-Addressing EndpointAddress for a service endpoint that supports
WS-MetadataExchange.

For more options about using this tool for metadata download, see
ServiceModel Metadata Utility Tool (Svcutil.exe).

Example
The following command downloads metadata documents from a running service.

svcutil /t:metadata http://service/metadataEndpoint

How to: Use Svcutil.exe to Validate Compiled Service Code

You can use the ServiceModel Metadata Utility Tool (Svcutil.exe) to
detect errors in service implementations and configurations without
hosting the service.

To validate a service
Compile your service into an executable file and one or more dependent
assemblies.

Open an SDK command prompt

At the command prompt, launch the Svcutil.exe tool using the following format.

svcutil.exe /validate /serviceName:<serviceConfigName> <assemblyPath>*


You must use the /serviceName option to indicate the configuration
name of the service you want to validate.

The assemblyPath argument specifies the path to the executable file
for the service and one or more assemblies that contain the service
types to be validated. The executable assembly must have an associated
configuration file to provide the service configuration. You can use
standard command-line wildcards to provide multiple assemblies.