大网数据广告活动
Web服务器与PHP

Scenario 2 Parser Example Using ETW Tracing

· 52CE 我爱测

To generate an ETW trace report for the HTTP Server API component, run the steps as shown in the \ 0034;Generating an ETW Trace Report \ 0034; section of Scenario 1 HTTP Timeout Example Using ETW Tracing and Netsh Commands, but reproduce the error specific to this scenario.

To generate an ETW trace report for the HTTP Server API component, run the steps as shown in the "Generating an ETW Trace Report" section of Scenario 1: HTTP Timeout Example Using ETW Tracing and Netsh Commands, but reproduce the error specific to this scenario. In this example, access the web application from a client machine, resulting in the "400 bad request" message being shown on the client. These steps are run on the server since it is hosting the web application.

Viewing the Trace and Diagnosing

The resulting CSV file for traces can be viewed in Excel or any tool that supports the CSV format. Table 2 below shows excerpts from a sample trace file (httptrace.csv). In the trace report, the "Level" column shows an entry with a value of "2", which represents an error. As noted above, the HTTP Server API component follows the ETW Levels defined in the article LevelType Complex Type Complex Type.

The ETW levels include: 1 Critical; 2 Error; 3 Warning; 4 Informational; 5 Verbose.

With this error, the event type (Type column) reports "ParseRequestFailed". In the subsequent columns for the ParseRequestFailed event, we see an "InvalidHost" entry. This entry means that the identified host in the HTTP Request is incorrect, according the HTTP protocol. Note the column with the "InvalidHost" entry is not included in the table for the sake of brevity and to avoid excerpting noncontiguous columns.

To fix this parsing issue, the web client should be corrected to be compliant with the HTTP RFC.

Event name Type Event ID Version Channel Level
EventTrace Header 0 2 0 0
Microsoft-Windows-HttpService AddUrl 31 0 16 4
Microsoft-Windows-HttpService ConnConnect 21 0 16 4
Microsoft-Windows-HttpService ConnIdAssgn 22 0 16 4
Microsoft-Windows-HttpService RecvReq 1 0 16 4
Microsoft-Windows-HttpService ParseRequestFailed 52 0 16 2
Microsoft-Windows-HttpService LogFileWrite 51 0 16 4

Table 2: Excerpts from a Sample Trace Report for a Parsing Issue

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。