Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:56:58+00:00 2026-05-16T17:56:58+00:00

I havent written a windows service before and thought everything was going well until

  • 0

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.

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()

and here is the code that is doing the looping:

        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);

        }

Does anyone have any idea why this would fall over after it runs the first time? am I doing something stupid?

This is the method causing the issue:

public static string GetXmlFromFeed(string strUrl)
{
var rssReq = WebRequest.Create(strUrl);
var rep = rssReq.GetResponse();
return new StreamReader(rep.GetResponseStream()).ReadToEnd();
}

On the GetResponse()

possible a time out and nothing to do with the threading at all then

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:56:59+00:00Added an answer on May 16, 2026 at 5:56 pm

    Looking at the exception stack trace it seems that the StartChecks throws an exception which is not handled and it propagates to the calling thread (this behavior was introduced in .NET 2.0 as before exceptions thrown in child threads weren’t propagated).

    Try putting a try/catch around it in order to handle this exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a Windows desktop application that works with Sqlite very nicely. It was
I have a Windows service written in C# that spawns several worker threads. Those
In the past, I've written Linq to SQL queries that haven't performed well. Using
I finally got apache2 with mod_wsgi working on Linux (havent much luck with windows
I have a bunch of scripts (which can't be modified) written on Windows. Windows
I am using Eclipse for C++ development on windows. I have also written a
I've got a Windows DLL that I wrote, written in C/C++ (all exported functions
In short : I have 2 windows applications(written using .NET) and need to pass
i'm reading a javascript source code , and i haven't written javascript before. i'm
I'm working with a somewhat unreliable (Qt/windows) application partly written for us by a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.