You need to have the following in your config file:
1) a service behavior for metadata:
<behaviors>
<serviceBehaviors>
<behavior name="Metadata">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
2) reference that service behavior in your service's config
<service name="wcfLib.StockService"
behaviorConfiguration="Metadata">
....
</service>
*The name value in the service tags in the config file must have the same name as the physical class that is implementing the contract. Remember if the class name changes, make sure to change this value to match.
3) an endpoint for MEX (metadata exchange)
<service name="wcfLib.StockService"
behaviorConfiguration="Metadata">
....
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
With all this in place, things should be just fine! :-)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…