Tracing WCF messages

When you need to see the actual WCF message that gets over the wire you could use tools such as TcpTrace but this won’t work immediatly.

The security of WCF doesn’t allow communication when the "To" header of the message isn’t the same as the endpoint address, to make it work you can do the following:

1. Change the configuration of your service to include a "listenUri" attribute:

<endpoint
   address="http://localhost:888/SomeService"
   listenUri="http://localhost:777/SomeService"
   binding="basicHttpBinding"
   contract="ISomeService"/>

This will cause the actual listener to run on port 777, in the WSDL you’ll still see port 888.

2. TcpTrace configuration:

listen port: 888
destination port: 777

3. On the client side make sure the endpoint is configured to send the messages to port 888 when TcpTrace is running.

Other WCF articles:
- MaxItemsInObjectGraph and keeping references when serializing in WCF
- WCF Routing
- Use your WCF proxies in a safe way

This entry was posted in WCF and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>