官方版

Problem: Unexpected 400 Bad Request Error from IIS Express

When requesting http://ipv4.fiddler:2468 from an IIS Express instance, the server returns the following unexpected error message:

  1. HTTP/1.1 400 Bad Request
  2. Content-Type: text/html;charset=us-ascii
  3. Server: Microsoft-HTTPAPI/2.0
  4. Date: Wed, 22 Aug 2012 19:59:52 GMT
  5. Connection: close
  6. Content-Length: 334
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""https://www.w3.org/TR/html4/strict.dtd">
  8. <HTML><HEAD><TITLE>Bad Request</TITLE>
  9. <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
  10. <BODY><h2>Bad Request - Invalid Hostname</h2>
  11. <hr><p>HTTP Error 400. The request hostname is invalid.</p></BODY></HTML>

Solution:

Replace http://ipv.fiddler:2468 with http://localhost.fiddler:2468.

谷歌翻译版

问题:IIS Expresss意外400请求错误

当从IIS Express实例请求http://ipv4.fiddler:2468时,服务器返回以下意外错误消息:

  1. HTTP/1.1 400 Bad Request
  2. Content-Type: text/html;charset=us-ascii
  3. Server: Microsoft-HTTPAPI/2.0
  4. Date: Wed, 22 Aug 2012 19:59:52 GMT
  5. Connection: close
  6. Content-Length: 334
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""https://www.w3.org/TR/html4/strict.dtd">
  8. <HTML><HEAD><TITLE>Bad Request</TITLE>
  9. <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
  10. <BODY><h2>Bad Request - Invalid Hostname</h2>
  11. <hr><p>HTTP Error 400. The request hostname is invalid.</p></BODY></HTML>

解决方案:

http://ipv.fiddler:2468 替换为 http://localhost.fiddler:2468.