3

Does anyone know if there is a replacement for HttpRuntime.UnloadAppDomain() in ASP.NET 5? I can't find HttpRuntime at all, is there going to be a function just like that?

koelkastfilosoof
  • 2,212
  • 1
  • 18
  • 28

1 Answers1

5

The way to gracefully shutdown your app domain in ASP.NET 5 is by using: IApplicationShutdown. You could even use that in combination with an IFileWatcher and your own configuration files … if you really wanted to mimic an app domain restart by bumping/touching a file. See this blog post http://shazwazza.com/post/aspnet-5-re-learning-a-few-things-part-1/

From this link http://forums.asp.net/t/2051838.aspx?How+to+restart+Aso+Net+5+application you can use something like below code to restart your application

 IApplicationShutdown _applicationShutdown;
    public AdminController(IApplicationShutdown applicationShutdown)
    {
        _applicationShutdown = applicationShutdown;
    }


    public IActionResult RestartApplication()
    {
        _applicationShutdown.RequestShutdown();
        ............
    }

For a deep dive into the ASP.NET 5 runtime, have a look at this https://msdn.microsoft.com/en-us/magazine/dn913182.aspx

StackTrace
  • 9,190
  • 36
  • 114
  • 202