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.