static void Main(string[] args) { _container = new Container(); _container.Options.DefaultScopedLifestyle = new LifetimeScopeLifestyle(); _container.Register <IHelloWorldService, HelloWorldService>(Lifestyle.Scoped); SimpleInjectorAccessor.RegisterContainer(_container); SimpleInjectorAccessor.Load(HelloWorldServiceInjector.LoadTypes); _container.Verify(); using (_container.BeginLifetimeScope()) { try { var isCodingExercise = Convert.ToBoolean(ConfigurationSettings.AppSettings["isCodingExercise"]); _helloWorldService = _container.GetInstance <IHelloWorldService>(); var result = _helloWorldService.GetStartMessage(isCodingExercise); Console.WriteLine(result); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("An error occurred."); Console.ReadLine(); } } }