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

  • Home
  • SEARCH
  • 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 8672795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:17:35+00:00 2026-06-12T19:17:35+00:00

I am doing a code review and found this piece of code. Does throwing

  • 0

I am doing a code review and found this piece of code. Does throwing an exception inside a thread bring down IIS? Read the comments.

         Thread unhandledExceptionThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
         {
              System.Threading.Thread.Sleep(90 * 1000);
              throw new ApplicationException("Thread 1");
         }));
         unhandledExceptionThread.Name = "IntentionalCrasher";
         Thread environmentExitThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
         {
              System.Threading.Thread.Sleep(100 * 1000);
              Environment.Exit(-500);
         }));
         environmentExitThread.Name = "Thread 2";
         unhandledExceptionThread.Start();
         environmentExitThread.Start();
  • 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-06-12T19:17:36+00:00Added an answer on June 12, 2026 at 7:17 pm

    It won’t bring “IIS down” but it will terminate the ASP.NET worker process. It will restart.

    Your code snippet first tries to die by throwing an exception. 10sec later, if that didn’t help, it takes matters into its own hands and kills the process.

    Alternatively, it could call AppDomain.Unload on the current domain. But this is a reasonable way to restart the worker process.

    Make sure rapid fail protection is disabled. This feature is the devil because it permanently shuts down your app after 5 failures. Permanently without notification. On any kind of error.

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

Sidebar

Related Questions

Doing a code review I've stumbled over GWM in Java-Spring-GWT web-application. As this product
I found some confusing code during code review and am a bit puzzled. Doing
I've started to review some code in a project and found something like this:
I am doing a code review, and have found alot of code with the
I've been doing some code review and this code seemed weird to me since
I hope this question is on topic. I was doing code review and stumbled
Can Monitor.Enter throw any exception. I am doing a code review and find that
I'm doing code review and came across a class that uses all static methods.
What is this code doing? Specifically the default(XX) part. I've never seen it before.
Let's say I'm doing a code. This code uses kontextua ads <div class=pread> <div

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.