3 Ways to Run Code Once at Application Startup in ASP.NET Core

Where exactly should a developer put the code to initialize the in-memory cache?

Sasha Marfut
Level Up Coding
Published in
3 min readOct 31, 2021

--

Photo by Clemens van Lay on Unsplash

Developers may find it necessary to execute some piece of code only once at ASP.NET Core application startup. For example, developers might need to populate an in-memory cache, run a background task, read configuration from…

--

--