Reputation: 127
we are using System.Diagnostic.Trace.CorrelationManager class to accomplish end to end tracing.The class has a guid property "ActivityId" which is generated by default on every request. Our tracing is working well on iis express but after deploy project on iis System.Diagnostic.Trace.CorrelationManager.ActivityId is not generated.
Upvotes: 2
Views: 1536
Reputation: 176
IIS Express will probably have a module configured which will be setting the ActivityId on the CorrelationManager. I believe a number of modules do this, one example is FailedRequestsTracingModule (you don't actually need be monitoring failed requests so may have less of a performance overhead) and many APM tools like Stackify will do the same.
If Trace.CorrelationManager.ActivityId is empty you could ensure IIS is configured to use a module that sets it or alternatively you can create a simple one like:
public class SetActivityIdModule : IHttpModule {
public void Init(HttpApplication context) {
context.BeginRequest += (sender, args) =>
{
if (Trace.CorrelationManager.ActivityId == Guid.Empty) Trace.CorrelationManager.ActivityId = Guid.NewGuid();
};
}
public void Dispose() {}
}
Upvotes: 2
Reputation: 127
The solutions i came up with enabling request tracing module on iis but that leads too much overload on server so i decided to generate it by my self instead of trusting on iis
Upvotes: 0