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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:51:40+00:00 2026-05-12T16:51:40+00:00

after doing some research it seems that AppDomains are not really a tool for

  • 0

after doing some research it seems that AppDomains are not really a tool for building a hosting server. From my understanding, the hosting server will still crash if there is an unhandled exception in a created AppDomain (if the exception is thrown from a thread in the created AppDomain). So in that case if the hosting server hosts a service which leaks exceptions this will bring down the default AppDomain as well.

So I guess from a server architecture point-of-view there is nothing better than creating child processes and monitoring them.

Is that correct or am I missing something with AppDomains?

thanks,
Christoph

  • 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-12T16:51:40+00:00Added an answer on May 12, 2026 at 4:51 pm

    If you can control the threads created in the other AppDomain, you can also handle exceptions by using catch-all blocks in the thread main method.

    Other than that, as long as you use the default host, I believe that your assumption is correct. However, if you host the runtime yourself, you can also handle unhandled exceptions.

    From a forum post on the topic:

    Well, it is possible. You’d have to
    create your own CLR host. That starts
    with ICorBindToRuntimeEx(). You get
    to have full control of AppDomains
    that throw exceptions. And it’s being
    used by MSFT software like ASP.NET and
    SQL Server 2005. When you write a
    service, you are working with the
    default CLR host implementation and it
    terminates the process when any
    unhandled exception is raised,
    regardless of what AppDomain caused
    the exception.

    Problem is, hosts like ASP.NET and SQL
    server have a very well defined code
    execution path. In a web server,
    managed code runs because of a page
    request. In a dbase server, it runs
    because of a query. When something
    bad happens, they have the luxury of
    simply aborting everything that the
    request started (killing the
    AppDomain) and returning a “sorry,
    couldn’t do it” status back to the
    client. You might have seen it,
    crashing the forums server on the old
    web site was pretty trivial but didn’t
    stop it from serving other requests.
    Not actually 100% sure about that.

    Your service implementation is
    probably not nearly as clean. I can’t
    tell, you didn’t say anything about
    it. It general, there’s a problem
    with aborting a thread. You always
    have to abort a thread when there’s an
    unhandled exception. A service
    typically has one thread, started by
    the OnStart() method. Aborting it
    kills the server until somebody stops
    and starts it again.

    You can definitely make it more
    resilient than that, you could start a
    “master” thread that launches child
    threads in response to external events
    that makes your service do its job.
    Having a child thread terminated
    because of an unhandled exception is
    something you could possibly recover
    from. But then, if you make that next
    step, why not have the child thread
    catch an exception and pass it back to
    the master thread so it can make an
    intelligent decision about what to do
    next.

    The cold hard fact of the default CLR
    host is: if you are not willing to
    deal with failure, it is not going to
    do the job for you. And it shouldn’t,
    the .NET 1.x behavior to threads that
    died with exceptions was a major
    mistake that got corrected in .NET
    2.0.

    You know what to do: handle failure.
    Or write you own host. Or accept that
    things could be beyond your control
    and log a good error message so you
    can tell your customer what to do.
    I’d strongly recommend the latter.

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

Sidebar

Related Questions

I'm not a bad web developer but it happens that I've never had to
We have written an application that manages OpenVPN from the tray as an add-on
I have a function, singleFrameEventHandler, that I wish to be called when a certain
In my search for a good, freely available resource that will teach me C++
In a previous post, I was advised to use a DataTemplate to render a
I'm trying to compile down a set of plug-ins (ultimately OSGi bundles) into a
In mid July 2008 Memoization was added to Rails core. A demonstration of the
I took a Computer Graphics exam a couple of days ago which had extra
When it's about archiving and doc portability, it's all about PDF. I heard about

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.