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 5995813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:00:52+00:00 2026-05-23T00:00:52+00:00

I have a .NET window Service which extend a custom base class, this serves

  • 0

I have a .NET window Service which extend a custom base class, this serves as base for many windows services i have written so far, now i want to do add some monitor (hearbeat) on this base class, on the initialized of the base class i start a thread that will notify a database and sleep for 40 sec, this is not perfect but serves its purpouse so far. I have registered an event for the AppDomain.CurrentDomain.DomainUnload, to stop the heartbeat threads, but when i stop the Window Service, my database updates are stopped but the logs that i have place in the event registered at AppDomain.CurrentDomain.DomainUnload are not appearing in the Event Viewer, so i dont have a clear indication if the event is getting fired or not.

I cannot place my heartbeat initialization into the OnStart / OnStop of my base classes, since it will require to recompile all my windows service to make sure all of them all call base.OnStart / base.OnStop.

Any idea why the AppDomain.CurrentDomain.DomainUnload is not getting fired

ps.

I tried also with AppDomain.CurrentDomain.ProcessExit with the same result as above, no logs in the EventViewer .

  • 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-23T00:00:53+00:00Added an answer on May 23, 2026 at 12:00 am

    Is the “CurrentDomain” the default app domain? I would guess so, unless you create custom domains. If so, then note that DomainUnload is not raised for the default domain.

    As for ProcessExit, I’m not sure, but note that a Windows Service’s lifetime is not necessarily bound to the process’ lifetime that hosts it. If a process hosts more than one Windows Service it will only exit, when all services are stopped.

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

Sidebar

Related Questions

I have written a .NET Windows service which has a WCF service built into
I have a standard .NET windows service written in C#. Can it install itself
I have a windows service (VB.NET) which downloads files from a server after a
I have a windows service which is using a method from a class library
I have a multithreaded .NET Windows Service that hangs intermittently -- maybe once every
We have taken over some .NET 1.1 Windows Service code that spawns threads to
I have built a windows service application in VB.net 2008, and used the Setup
I have asp.net form that contains fields. When I access this window, my javascript
I have a .NET 2.0 windows forms app, which makes heavy use of the
I have a Windows Service developed in C# and .NET 3.5 to perform various

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.