HTTP/1.1 401 Unauthorized mit Fiddler

Zur Analyse von HTTP- und HTTPS-Verbindungen nutze ich besonders gern als HTTP Debugging Proxy die Freeware Fiddler. Unter manchen Umständen bekommt man beim Einschalten von Fiddler jedoch Schwierigkeiten, Webservices mit NTLM-Authentifizierung ansprechen zu können. Man bekommt nur eine 401 Fehlermeldung zurück:

HTTP/1.1 401 Unauthorized
Content-Length: 83
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: NTLM
Date: Sat, 15 Nov 2008 10:19:37 GMT

<html><head><title>Error</title></head><body>Error: Access is Denied.</body></html>

Nach einigen Suchen im Internet stieß ich in dem Artikel Fiddler and TFS don't play nicely auf einen Kommentar von Eric Lawrence:

The issue here is that TFS is throwing exceptions because it expects a Connection: close header when Fiddler isn't sending one. You can easily fix this in Fiddler. Click Rules > Customize Rules. Scroll down to the bottom of OnBeforeResponse. Uncomment the lines:

// Uncomment to reduce incidence of "unexpected socket closure" exceptions in .NET code.
// Note that you really should also fix your .NET code to gracefully handle unexpected connection closure.
//
// if (!(((oSession.responseCode == 401) && oSession.oResponse["WWW-Authenticate"].Length > 9) ||
// ((oSession.responseCode == 407) && oSession.oResponse["Proxy-Authenticate"].Length > 9))) {
// oSession.oResponse["Connection"] = "close";
// }

Gestoßen bin ich auf das Problem, als ich mit Internet Explorer 8 Beta 2 auf Windows 7 Pre-Beta versuchte, Fiddler wie gewohnt zur Analyse einer HTTP-Verbindunng zu nutzen. Der Tipp hilft auch hier.