With the .NET agent enabled for a Windows Communication Foundation (WCF) application, the response header
Content-Type is unexpectedly changed to
Disable the Cross Application Tracing (CAT) feature.
Read about how to change the CAT configuration.
If you need CAT to remain enabled, see the other solutions.
Use the Distributed Tracing (DT) feature instead of CAT.
Read about how to enable the DT configuration.
DT is a new and improved way to accomplish tracing and has enhanced features, compared to CAT, in the New Relic UI.
DT doesn't require modifications to response headers and won't be affected by changing response headers.
Add your desired
This solution requires you to modify your application code.
The Cross Application Tracing (CAT) feature is enabled by default in the .NET agent. CAT works by adding headers to both request messages and response messages.
This is what happens in the Agent:
- The WCF service method implementation executes.
- The agent will attempt to add CAT headers to the WCF response by adding an
HttpResponseMessagePropertyinstance, with the CAT headers, to
- The custom
DispatchMessageFormatterexecutes and creates a new message where the expected
Content-Typeheader is added directly to the new message.
- Microsoft’s WCF implementation will attempt to merge the message properties defined in the response message with the message properties defined in the
OperationContext. See this Microsoft reference on ImmutableDispatchRuntime.cs for more details.
HttpResponseMessagePropertydoesn't support merging, so the value defined in the
OperationContextis used instead of the value defined in the message.
- As a result, the
Content-Typeheader that was originally added to the formatted message is thrown away, and the default
Content-Typeheader is used.
Since the agent must support multiple WCF Bindings, it needs to add our CAT headers to the
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.