Deploying an ASP.NET Core App to Azure App Services via Visual Studio

Azure App Services is a Platform as-a Service (PaaS) service provided by Microsoft Azure as a part of its cloud services and products. Azure App Services facilitate easy deployment and maintenance of various tech stack applications without having to worry about individual components or the hosting environment

What is a Scoped service?

A scoped service instance is created only once within a request scope and is reused for all calls within that request.

services.AddScoped<IMyClass, MyClass>();

What is a Transient service?

A transient service instance is created each time a calling component method or dependent class requests for an instance from the container.

services.AddTransient<IMyClass, MyClass>();

What is a Singleton service?

A singleton service instance is created only once during entire application lifetime, common across all requests.

services.AddSingleton<IMyClass, MyClass>();

How do you register services?

A class can be registered as a service by adding it to the IServiceCollection instance under the ConfigureServices() method in the Startup class.

A class MyClass can be registered as a service in the below ways:

services.AddT<MyClass>(new MyClass()); (or)
services.AddT<new MyClass());
services.AddT<IMyClass, MyClass>(); (or)
services.AddT<IMyClass>(new MyClass());

Where T can be Singleton, Transient or Scoped.