title: Simple threading issue with windows service
body: <p>I havent written a windows service before and thought everything was going well until I deployed it to live. In dev it works fine and the polling it great, but as soon as it goes into production it falls on its backside after its first loop.</p>
  
  <pre><code>The exception I recieve is: 
  Application: ProgramName.WinService.exe
  Framework Version: v4.0.30319
  Description: The process was terminated due to an unhandled exception.
  Exception Info: System.Exception
  Stack:
     at ProgramName.WinService.UpdateChecker.StartChecks()
     at ProgramName.WinService.UpdateChecker.StartPolling()
     at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Threading.ThreadHelper.ThreadStart()
  </code></pre>
  
  <p>and here is the code that is doing the looping:</p>
  
  <pre><code>        private readonly Thread pollingThread;
  
     public UpdateChecker()
      {
          pollingThread = new Thread(StartPolling);
          InitializeComponent();
      }
  
          protected override void OnStart(string[] args)
          {
              pollingThread.Start();
          }
  
          protected override void OnStop()
          {
              pollingThread.Abort();
          }
  
  
          protected void StartPolling()
          {
              do
              {
                  StartChecks();  
  
                  //10 seconds
                  Thread.Sleep(10000);
              } while (true);
  
          }
  </code></pre>
  
  <p>Does anyone have any idea why this would fall over after it runs the first time? am I doing something stupid?</p>
  
  <p>This is the method causing the issue:</p>
  
  <p>public static string GetXmlFromFeed(string strUrl)
      {
          var rssReq = WebRequest.Create(strUrl);
          var rep = rssReq.GetResponse();
          return new StreamReader(rep.GetResponseStream()).ReadToEnd();
      }</p>
  
  <p>On the GetResponse()</p>
  
  <p>possible a time out and nothing to do with the threading at all then </p>