asp.net - win7 PC 上的 ASP.NET ETW 提供程序丢失

标签 asp.net trace provider etw

我正在编写一个 ETW 使用者来监听 ASP.NET 事件。我有下面的示例代码在 Windows 2008 服务器上运行良好,它可以看到 ASP.NET 提供程序。我遇到的问题是,在我的 Win7 (64) PC 上,我看不到 ASP.NET 提供程序,因此此代码将所有事件显示为“未处理”。
我已确保安装了跟踪功能,并且 applicationhost.config 文件中包含相应的值。

当我执行 logman –query providers 时,我看不到
ASP.NET AFF081FE-0247-4275-9C4E-021F3DC1DA35 提供程序在 PC 上,但我在我正在测试的 Win2008 服务器上看到了这个。

我该如何执行以下两项中的一项:
将此作为提供程序添加到我的 Win7 PC 中?

或者

让代码能够处理此消息并在我的代码中提供 list 。当我将“AFF081FE-0247-4275-9C4E-021F3DC1DA35”设置为提供者时,我确实收到了事件,但它们来自未知的提供者。所以我猜 list 内容丢失了。

我的示例代码如下

    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;
    }

最佳答案

ASP.NET 跟踪在您的本地计算机中不可用的原因是它未安装。如果你看 perfview help it 为您提供有关如何启用它的说明。

仅供引用 perfview 使用 TracEevent捕捉痕迹。

这里是

ASP.NET Events
ASP.NET has a set of events that are sent when each request is process. PerfView has a special view that you can open when ASP.NET events are turned on. By default PerfView turns on ASP.NET events, however, you must also have selected the 'Tracing' option when ASP.NET was installed for these events to work. Thus if you are not seeing ASP.NET events you are running an ASP.NET scenario this is one likely reason why you are not getting data.

To turn on ASP.NET Tracing

The easiest way to turn on tracing is with the DISM tool that comes with the operating system. Run the following command from an elevated command prompt

DISM /online /Enable-Feature /FeatureName:IIS-HttpTracing

Note that this command will restart the web service (so that it takes effect), which may cause complications if you ASP.NET service handles long (many second) requests. This will either force DISM to delay (for a reboot) or abort the outstanding requests. Thus you may wish to schedule this with other server maintenance. Once this configuration is done on a particular machine, it persists. You can also do this configuration by hand using a GUI interface. You first need to get to the dialog for configuring windows software. This differs depending on whether you are on a Client or Server version of the operating system.

On Client - Start -> Control Panel -> Programs -> Programs and Features -> Turn Windows features on or off -> Internet Information Services -> World Wide Web Services -> Health and Diagnostics -> Tracing On Server - Start -> Computer -> Right Click -> Manage Roles -> Web Server (IIS) -> Roll Services Add Role Services Health and Diagnostics -> Tracing



希望这可以帮助。

关于asp.net - win7 PC 上的 ASP.NET ETW 提供程序丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29847815/

相关文章:

android - (最佳)向自定义内容提供者传递控制消息的方法

c# - 如何获取在 ASP.NET C# 中请求的文件的 MIME 类型?

java - 有java异步跟踪框架吗?

linux - 使用 Babeltrace 构建 Perf(用于 Perf 到 CTF 的转换)

iOS 9 中的数据包隧道提供程序

Flutter 使用 ListView.Builder : how can i change background color of only one item on all items with i selected it

c# - 数据库优先和区域

c# - Asp.Net 中的 Telerik Report - 以编程方式应用过滤器

c# - 使 span 元素在中继器的 ItemBound 事件中可见

python - 结合 Python 跟踪信息和日志记录