HTTP 400-Cannot Resolve the Request

Applies To: Windows Server 2003, Windows Server 2003 with SP1

IIS returns a 400 error code when the request is malformed. Though there are a variety causes for this error, the most common reason is that the request does not comply with RFC 2616. For example, if the request is made in HTTP 1.1, RFC 2616 requires that the request include a Host header. The simplest HTTP 1.1 request would look similar to the following:

GET / HTTP/1.1
Host: example.contoso.com

You can use WFetch to issue such a custom-built request. Most HTTP clients adhere to HTTP RFC 2616 and issue well-formed requests. However, if you are developing a custom HTTP client and are experiencing HTTP 400 problems, use WFetch to make test requests.

To issue a simple HTTP 1.1 request using WFetch

  1. Start WFetch.

  2. From the Advanced Request list box, click Raw Request.

  3. In the box, type the following text, where ComputerName is the name of your server running IIS:

    GET / HTTP/1.1\r\n
    Host: ComputerName\r\n
    \r\n
    
  4. Ensure that the Host box contains the same ComputerName as noted above.

  5. Click Go.

This sends the most basic HTTP 1.1 GET request to the server.

HTTP.sys records some errors in its own log file. Table 11.5   HTTP.sys Logged Reason Codes for HTTP 400 Errors lists the HTTP.sys reason codes and explanations for each of the 400 errors. These errors are not recorded in the IIS logs.

Table 11.5 HTTP.sys Logged Reason Codes for HTTP 400 Errors

Reason Code Condition

BadRequest

The request could not be understood by the server because the syntax was incorrect.

In the following instances, HTTP.sys, the kernel-mode driver, will reject a request as a BadRequest. HTTP.sys returns an HTTP 400 error (Bad Request) to the client. This HTTP 400 error is not customizable:

  • The verb used in the request is invalid.

  • The requested URL is invalid.

  • The requested header name is invalid.

  • The requested hostname is invalid.

  • The request contains an invalid carriage return and/or line feed as a terminator.

  • The request contains an invalid content length header or invalid entity chunk length.

  • The cumulative length of the headers in the request is longer than the maximum allowed.

  • The header field in the request is too long.

  • The request header is too long.

Verb

Invalid verb.

URL

Invalid URL.

Header

Invalid header name.

Hostname

Invalid hostname.

Invalid_CR/LF

Invalid carriage return or line feed.

Number

Invalid number.

FieldLength

A header field in the request was too long.

RequestLength

The request length was too long.