The WCF service reference does not include comments from the original service methods

advertisements

I have created a simple WCF web service with a method. This method has comments on it.

Why does the comment not appear in the service reference for a consuming app?

Is there some other way to propagate to method comments to the proxy?

/// <summary>
/// Do some work
/// </summary>
public void DoWork()
{
}


It doesn't appear on the service reference because the comments aren't part of the service metadata. There are two options you can use to have the comments appear on the proxy:

  • Share the contract interface between the server and the client (i.e., not generate the proxy, but simply reuse your interface on the client side).
  • Use some custom WSDL export extension which is aware of the comments (or other attributes), and a custom WSDL import extension which can understand those when generating the client. The sample at http://msdn.microsoft.com/en-us/library/aa717040.aspx is one possible implementation.