The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,843 other followers

Fiddler replaying requests to the ASP.NET Development Server: XP works but Vista not, or “when localhost is not 127.0.0.1 in Fiddler 2”

Posted by jpluimers on 2009/12/09

Today, I bumped into something utterly strange: requests replayed through Fiddler 2 to a locally running ASP.NET Development Server on Vista using localhost URLs did not give a connection.

I use ASP.NET from both C# and Delphi Prism. Most of my development work is on Windows XP (see notes below) but I test on many platforms.
Moving one of the projects from XP to Vista, and testing with Fiddler, I found that when using Fiddler 2:

This form of URL fails on Vista, but works on XP: http://localhost:49703
This form of URL works both on Vista, and XPhttp://127.0.0.1:49703

So on Vista – contrary to XP – localhost requests from Fiddler were in fact being sent to the external network adapter on Vista, and the 127.0.0.1 requests to the internal network adapter.
Since the ASP.NET Development Server is bound only to the internal network adapter, external requests don’t work (boy, I wish they did, it would make some of my debugging so much easier!).


Both URL’s work fine when running on the same setup in XP SP3.

Both URL’s work fine on Vista when executed from within Internet Explorer, Chrome or FireFox (I could have tested more browsers, but you get the picture: Fiddler behaves differently than the web browsers; I tested Fiddler versions 2.2.2.2 and 2.2.7.9).

So why does it fail in Vista, despite the fact that the HOSTS file looked like this:

## Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#…

127.0.0.1 localhost
::1 localhost

And both HOSTS file also had the right security settings:

C:\Windows\System32\drivers\etc>icacls hosts
hosts NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
BUILTIN\Users:(I)(RX)

I’m glad that the 127.0.0.1 notation in the URL works from Fiddler 2, but I’m still a bit confused: I was “raised” in TCP/IP land with a trust in HOSTS files. Apparantly I can’t.

I have yet to test disabling the IPv6 stack on the Vista machine to see if this solves the issue (like it solves a similar issues here and here).
I’d rather not disable IPv6, because some of the networks do use IPv6, but testing is on the todo-list.
I also need to regression test this against Windows 7. So that is also on the todo-list.

–jeroen

PS: Some notes:

The HOSTS file is formally in %windir%\System32\drivers\etc\hosts, usually in C:\Windows\System32\drivers\etc\hosts, pitty that WordPress does not allow for URL’s like file:///C/Windows/System32/drivers/etc/hosts, they get truncated to ///C/Windows/System32/drivers/etc/hosts .

I still use XP and Office 2003 for a lot of work. Partially because I’m old skool, but mainly because I dislike the fact that a very large company suddenly changed keyboard shortcuts (I did mention old skool) that have been in place for so long not only in their OS, but also in their Office Suites.
So I now use Vista and/or Windows 7 as host operating systems (because they support more than 4 gigs of memory) and mostly XP in development guests.

2 Responses to “Fiddler replaying requests to the ASP.NET Development Server: XP works but Vista not, or “when localhost is not 127.0.0.1 in Fiddler 2””

  1. Franz-Leo Chomse said

    In Vista and Windows 7 localhost is set to the IPv6 name of the local machine as can be checked with a “ping localhost” command

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: