Why do I get ThreadAbortException when asp.net site starts

With the MVC 5 project we are working on, I continue to get a ThreadAbortException every time the application starts (while the debugger is connected). I assumed this was application related, so I created an empty project with one controller and an empty view.

HomeController.cs:

public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } } 

An exception still occurs as soon as Webapp is started and the debugger is connected. As you can see, there is no Response.Redirect that can call it. And there is no extra code in Global.asax that can deploy an extra stream.

Global.asax.cs

 public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); } } 

An exception occurs when I do a reconnect, run the application with the debugger attached, and exactly as soon as the application starts. There is no stacktrace, and it does not end the application, simply:

An exception of type "System.Threading.ThreadAbortException" was excluded in mscorlib.dll and was not processed to a managed / native border

I am using Visual Studio 2013 (Update 2) and the application runs in IIS Express. The project is focused on .NET 4.5 and has Razor views.

Is there anything else I can try?

+5
source share
1 answer

It turns out that all I had to do was disable this option:

Visual studio debugging setting

For those who are interested, go to the "Tools" → "Options" → "Debug" → "General" → at the top of the page.

Of course, this does not prevent the exception. Therefore, I would still like to know why a ThreadAbortException is thrown across a managed border.

+8
source

Source: https://habr.com/ru/post/1201313/


All Articles