I looked through the documentation on the Microsoft website and there are two places where we can set up the configuration.
We can do it either in Startup.cs or Program.cs. However, Program.cs has the same methods that are available in Startup.cs
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureServices(services =>
{
//same as ConfigureServices method in Startup.cs
services.AddAutofac();
})
.Configure(app =>
{
//same as Configure method in Startup.cs
app.UseMvc();
})
.Build();
}
Is the only purpose for the existence of "Startup.cs" to move some of the configuration out of "Program.cs"? Could we remove this file altogether and keep the entire configuration in "Program.cs"?