Very slow web browsing to site name in your hosts file? Blame ISA Server

We’ve started using the Windows Azure Accelerator for Web Roles, but that’s not the point. It is one use-case where you might create an entry in your hosts file (at %SystemRoot%\System32\Drivers\etc). But there are a whole host (haha) of gotchas on the way:

  • In order to edit that file with UAC enabled, you need to use a copy of notepad (or whatever) in elevated (Run As Administrator) mode
  • If you have a proxy configured (or even “Automatically detect settings” with a corporate proxy using wpad or whatever) in your browser’s LAN Settings, it’ll never look in the hosts file, so you’ll need to disable that or make an exception
  • If, once you’ve got to here, it works but it’s excruciatingly slow, it may be your firewall. Well, it took me a while to figure it out, but we have ISA Server 2006 as our firewall, and in order to check certain rules which list domain names, ISA Server needs a domain name. To ensure that you haven’t tried to be “clever” by entering an ip address on your url, it attempts a reverse DNS on the IP address it’s connecting to. And Microsoft, like many other hosting companies, haven’t bothered to add RDNS entries for all their Azure server IP addresses. The resulting RDNS timeout adds hugely to the delay while each element of your site is loaded.

ISA Server 2006 specific fix: Enable the option to prevent this DNS access:  “SkipNameResolutionForAccessAndRoutingRules”:

' Create the root object
Dim root  ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")

' Declare the other objects needed.
Dim isaArray     ' An FPCArray object
Dim webProxy     ' An FPCWebProxy object
Dim restartMask  ' A 32-bit bitmask of type FpcServices

' Get references to the array object
' and the Web proxy object. 
Set isaArray = root.GetContainingArray()
set webProxy = isaArray.ArrayPolicy.WebProxy

' Configure the Web proxy to skip name resolution
' while checking access and routing rules and save
' the new configuration. 
webProxy.SkipNameResolutionForAccessAndRoutingRules = True
restartMask = webProxy.GetServiceRestartMask

' Restart the firewall service so that
' the change will take effect.
isaArray.RestartServices restartMask

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

Just paste the code into a text file, save as .VBS and run using cscript.

See;EN-US;891244 for details.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s