;

Running aspnet core on Microsoft Azure

I have been developing asp.net core applications for a couple of years now, and tried som things that work and a lot of things that doesn't. Coming from an on-premise asp.net MVC 5 developing career, it's easy to resort to applying the same technologies in the cloud, and sometimes it will work, other cases it will not.

To start with, Azure is cheap... and expensive. If you do bad things in the cloud, it will be expensive, maybe so expensive it will not possible to migrate to a cloud based environment from an on-premise environment.

On-premise vs Azure

Quite often, an on-premise solution does not have the same performance restrictions as you have in the cloud. If you are running your own server it's quite often easier and/or cheaper to upgrade your hardware.

The smallest App Service Plan (S1) have 1.75 GB of memory, I guess most on-premise servers you worked with have a lot more than that. Most on-premise SQL Servers have significantly more performance than a reasonable priced Azure Single SQL Server Database. Especially for smaller projects is not possible to get an return on investment for larger databases.

I've put together a list with some tips and trix for making your asp.net core applications running smoothly an minimize problems when developing these apps. Some tips I've used previously but moving to the cloud really highlighted the importance of the practice. Also some tips may come up as pretty obvious, but it might be helpful for someone. These articles are kept very short to only focus on the most basic. For more extensive information there are other articles on the specific topic.

My Tips for running an asp.net core app in azure

Cache!
Why cache is important and how to use it, don't just add services.AddMemoryCache();.

UTC, always use UTC
Although it is possible, don't change the timezone on your App Service Environment.

Dependency injection
DI is your friend, but know the difference of AddTransient, AddScoped and AddSingleton, and yes, you should inject services into your .cshtml-files.

[Prepare your data](/doc/running-aspnet-core-on-azure-prepare-your-data) \ Huge SQL queries is your enemy.
[Servicebus](/doc/running-aspnet-core-on-azure-servicebus) \ Asynchronous messaging, when work needs to be done.
[Mix storagesolutions](/doc/running-aspnet-core-on-azure-servicebus-mix-storagesolutions) \ Forget ACID
[Webjobs](/doc/running-aspnet-core-on-azure-webjobs) \ Does the job
[Azure Functions](/doc/running-aspnet-core-on-azure-functions) \ Not for interactions
[Cosmos DB](/doc/running-aspnet-core-on-azure-cosmos-db) \ Try cosmos DB!