tags:

views:

192

answers:

3

I have a simple test application (C# console application) that does an HTTP GET to a .NET resource:

static void Main(string[] args)
    {
        while (true)
        {
            try
            {
                System.Net.WebRequest req = System.Net.WebRequest.Create("http://ranger/roztest/Default.aspx");

                System.Net.WebResponse resp = req.GetResponse();
                System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());

                Console.WriteLine(DateTime.Now.Ticks.ToString() + " - " + sr.ReadToEnd().Trim());
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.Ticks.ToString() + " - " + "An Exception has occured: " + ex.GetType().ToString() + " - " + ex.Message);
            }

            Thread.Sleep(2000);
        }
    }

If I execute the following command:

net stop w3svc

IIS will stop. The command line utility that I wrote will return a System.Net.WebException "(404) Not Found".

If IIS is stopped, which process is returning that 404?

Is it the svchost.exe that contained the IIS service?

Background Information:
I'm running that Default.aspx page under IIS 7 on Windows 7 (x64) Professional.

The WebException is being thrown on the "req.GetResponse()" line.

A: 

You are sending a request to the maching "ranger". Is that the same as the machine on which you stopped IIS?

feroze
Yes. Correct. My development machine, "Ranger", is running both IIS and the command line utility. IIS on this machine is in a stopped state when running the code example I listed.
Joshua Hayworth
A: 

I believe (if you truly are connecting to a server which is simply not responding) it might be the .NET network stack itself that is throwing the exception -- probably related to a connection timeout.

Dan Esparza
I'm not sure if a "server" process is running. It may be some some sort of kernel thread that is doing the "listening" on port 80. Check out the following pictures:http://www.flickr.com/photos/hayworthfamily/3911114750/http://www.flickr.com/photos/hayworthfamily/3911114768/That is a couple of screen shots that I uploaded to flickr showing the output of TCPView. *Something* is listening on port 80 and returning that 404, it's just not IIS.
Joshua Hayworth
+1  A: 

More clues emerge:

Check out the following post from Mike Volodarsky:

Starting with Windows 2003, IIS uses the http.sys kernel driver to listen for requests, and the W3SVC service to configure it to listen for requests on all binding endpoints associated with your site. On IIS7, the service doing most of the work is now called WAS (even though W3SVC is till needed). A configuration error can cause WAS/W3SVC to fail to start a site, and therefore http.sys will not receive requests on its endpoints. Also, there is the off chance that the site definition itself is missing, or the site does not define the right bindings.

And even a tool to configure the http.sys driver.

Joshua Hayworth