ServiceModel Metadata Utility Tool (Svcutil.exe)

https://msdn.microsoft.com/en-us/library/aa347733.aspx

 The ServiceModel Metadata Utility tool is used to generate service model code from metadata documents and metadata documents from service model code.

SvcUtil.exe

The ServiceModel Metadata Utility Tool can be found at the Windows SDK installation location, specifically, C:Program FilesMicrosoft SDKsWindowsv6.0Bin

Functionalities

The following table summarizes the various functionalities provided by this tool and the corresponding topic that discusses how it is used.

Timeout

The tool has a 5 minute timeout when retrieving metadata.

This timeout only applies to retrieving metadata over the network.

It does not apply to any processing of that metadata.

Multi-targetting

The tool does not support multi-targeting.

If you want to generate a .NET 4 artifact from svcutil.exe, you have to use the svcutil.exe from the .NET 4 SDK.

To generate a .NET 3.5 artifact, use the executable from the .NET 3.5 SDK.

Accessing WSDL Documents

When you use Svcutil to access a WSDL document that has a reference to a security token service (STS), Svcutil makes a WS-MetadataExchange call to the STS.

However, the service can expose its WSDL documents using either WS-MetadataExchange or HTTP GET.

Therefore, if the STS has only exposed the WSDL document using HTTP GET, a client written in WinFX will fail.

For clients written in .NET Framework 3.5, Svcutil will attempt to use both WS-MetadataExchange and HTTP GET to obtain the STS WSDL.

Using SvcUtil.exe

Common Usages

The following table shows some commonly used options for this tool.

参数:

/directory:<directory>  

描述:

Directory to create files in. Default: The current directory.  

Short form: /d   缩写

Metadata Export

Service Validation

Metadata Download

XmlSerializer Type Generation

Examples 

Maximum Nametable Character Count Quota

Security Concerns

How to: Use Svcutil.exe to Download Metadata Documents

To download metadata using Svcutil.exe

  1. Locate the Svcutil.exe tool at the following location:

    C:Program FilesMicrosoft SDKsWindowsv1.0. in

  2. 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.

  3. 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.

原文地址:https://www.cnblogs.com/chucklu/p/4650287.html