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

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

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s