To configure message tracing, follow these steps in the Configuration Editor:
- In the Diagnostics folder, click Message Logging and set LogEntireMessage to True. Also set LogMessagesAtServiceLevel and/or LogMessagesAtTransportLevel to True, depending on your needs. Most of the time these messages will be identical. If you are encrypting at the message level, then the message logged at the transport level will be encrypted. If you are encrypting at the transport level, then both will be unencrypted and practically identical. The Transport Level is the host level. So this is logged when the host (IIS in most cases) redirects the message to the service. The Message Level is the actual service level.
- In the Diagnostics folder, right-click Sources and choose New Source.
- From the drop down, choose System.ServiceModel.MessageLogging
- Choose Verbose as the Trace Level.
- In the Diagnostics folder, right-click Listeners and choose New Listener.
- Type "MessageLog" as the Name.
- In the InitData field, use the browse button to set a path and filename of the logfile.
- TraceOutputOptions: Click the drop down and select which options you want. I just like to include the DateTime
- TypeName: Click the ellipses and choose System.Diagnostics.XmlWriterTraceListener
To view the log file, you want to use a tool called Microsoft Service Trace Viewer. I believe this is included with Visual Studio. To find it just do a search using the start button for Service Trace Viewer. Or try just right-clicking the log file and choosing Open.
An alternative way to accomplish this is:
UPDATE 7/22/2015: Curiously, I couldn't find it on a PC that I know has .NET installed. I found it here: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
UPDATE 7/24/2015: Added the alternative method of setting up tracing. I had some issues getting the standard method to work.
An alternative way to accomplish this is:
- Click the Diagnostics folder and then click the Enable Message Logging link.
- Set the Log Level by clicking the link next to the "Log Level:" label and only check the Service messages box.
- Click on the link of the listener, and choose a location and options as described above.
- You may also want to click the Message Logging node and choose Log Entire Message.
- You may also want to click the Source that was created and select Verbose.
UPDATE 7/22/2015: Curiously, I couldn't find it on a PC that I know has .NET installed. I found it here: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
UPDATE 7/24/2015: Added the alternative method of setting up tracing. I had some issues getting the standard method to work.
No comments:
Post a Comment