I am writing an ETW consumer to listen for ASP.NET events. I have the sample code below working nicely on a Windows 2008 server where it can see the ASP.NET provider. The problem that I am running into is that on my Win7 (64) PC, I do not see the ASP.NET provider so this code shows all the events as “unhandled”. I have made sure the tracing feature is installed and the applicationhost.config file has the respective values in it.
When I do a logman –query providers, I do not see the ASP.NET AFF081FE-0247-4275-9C4E-021F3DC1DA35 provider on the PC, but I see this on the Win2008 server that I am testing on.
How can I do one of the two items below: Add this as a provider to my Win7 PC?
OR
Have the code able to handle this message and provide the manifest in my code. When I set “AFF081FE-0247-4275-9C4E-021F3DC1DA35” as a provider, I do get events but they are from unknown provider. So I am guessing the manifest content is missing.
My sample code is below
static void Test3()
{
var sessionName = "ASPNETMonitorSession";
using (var session = new TraceEventSession(sessionName, null))
{
Console.WriteLine("Starting Test1");
session.StopOnDispose = true;
Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
{
session.Dispose();
};
using (var source = new ETWTraceEventSource(sessionName, TraceEventSourceType.Session))
{
Action<TraceEvent> action = delegate(TraceEvent data)
{
Console.WriteLine("GOT EVENT: " + data.ToString());
};
var registeredParser = new RegisteredTraceEventParser(source);
registeredParser.All += action;
source.UnhandledEvents += delegate(TraceEvent data)
{
if ((int)data.ID != 0xFFFE)
Console.WriteLine("GOT UNHANDLED EVENT: " + data.Dump());
};
session.EnableProvider(new Guid("AFF081FE-0247-4275-9C4E-021F3DC1DA35"));
Console.WriteLine("Starting Listening for events");
source.Process();
}
}
Console.WriteLine("Done");
return;
}