Which process returns the error "(404) Not Found"

I have a simple test app (C # console app) that does an HTTP GET on 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 ran the following command:

net stop w3svc

      

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

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

Is it svchost.exe that contains IIS?

Background:
I am running this Default.aspx page under IIS 7 on Windows 7 (x64) Professional.

WebException thrown on line req.GetResponse ().

+2


source to share


3 answers


Additional tips will appear:

Note the following message from Mike Volodarsky :



Beginning in Windows 2003, IIS uses the http.sys kernel driver to listen for requests, and the W3SVC service uses it to listen for requests on all binding endpoints associated with your site. In IIS7, the service that does most of the work is now called WAS (although W3SVC is required before). a configuration error can cause WAS / W3SVC to not start the site and therefore http.sys will not receive requests to its endpoints. Also, there is a possibility that the site itself is missing or the site does not define the right to bind.

And even a tool for configuring the http.sys driver .

+2


source


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



0


source


I believe (if you are actually connecting to a server that just isn't responding) it might be the .NET networking stack itself that is throwing an exception - probably due to a connection timeout.

0


source







All Articles