ASP.NET Core correct usage of ConfigureAwait with async/await

Lately we had a discussion on when to use ConfigureAwait(true) or ConfigureAwait(false) in ASP.NET Core 2. In the end most of the team, including me, had a faulty assumption on how to do this in ASP.NET Core. In this case ASP.NET Core is different from ASP.NET. Good to know if you have to decide on what to use in ASP.NET core.

Continue reading “ASP.NET Core correct usage of ConfigureAwait with async/await”

Advertisements

Cross process Application Insights with Multi-Role Application Map

Use Multi-Role Application Map to monitor cross process dependencies

When using Application Insights to monitor your Microservices environment, it would be nice to track calls over process boundaries. Application Insights has a preview for Multi-Role Application Maps. This enables you to visualize the dependencies over multiple processes and name the different processes. In this blog posts I will explain how to enable Multi Role Application Maps preview, give you different process names and add dependency tracking into your application. Continue reading “Cross process Application Insights with Multi-Role Application Map”

Implement Pessimistic Concurrency in Entity Framework Core

ConcurrencyIn a scenario where we were using SQL server as a queue, before publishing events to external queues, we wanted the data to be processed only once and in order, even with multiple processors for failover. When reading from the table we wanted to lock the records and block other processors from reading those records, while being processed. This is called Pessimistic Concurrency, unfortunately Entity Framework Core does not support this out of the box. To realize Pessimistic Concurrency you need to write your own SQL queries directly on the database (The solution is database type bound, in this case Microsoft SQL server). This blog post will show how it can be accomplished.
Continue reading “Implement Pessimistic Concurrency in Entity Framework Core”

Get your web application errors into Slack

Get your devops going by integrating your application into your team communication tooling.

bugbotTo get more out of Slack and your team, you can integrate Slack with your application. Integrating with slack is done with webhooks. In this sample I use a Incoming Webhook to post the messages from the application to slack. By adding a GlobalExceptionFilter to you .Net Core web application, you can get all exceptions that are not handled in your web application.
Continue reading “Get your web application errors into Slack”

Application Shutdown in ASP.NET Core

Handling flushing of the application insights messages when asp.net core shutsdown

When running a ASP.NET Core web application there are cases when you need to do some logic when the application stops. An example: you are logging and have to flush the last message to the log (Application Insights). In that case you need can add an event in the Configure method. In this post I show a short example of how to do this.
Continue reading “Application Shutdown in ASP.NET Core”

Use VSTS to deploy Functions as Infrastructure as Code

Create a VSTS release pipeline for Azure Functions

Azure Functions enable you to easily run small pieces of code in the cloud. To do this right, you need to setup continuous delivery of the infrastructure and the code involved. Otherwise you will end with an uncontrolled environment where nobody knows what code is actually running. In this blog post I’ll describe how to setup a deployment pipeline for Functions with VSTS. This will enable you to deploy Functions as Infrastructure as Code.

vstsfunctionpipelineFrom an deployment perspective an Azure Function contains of two parts:

  1. Azure infrastructure
  2. Function code

Both the ARM template and the code can be deployed from VSTS. By doing this, you can manage functions like any other Azure resource.
Continue reading “Use VSTS to deploy Functions as Infrastructure as Code”

Make a .NET Core CLI Extensions

.NET Core comes with a new tool chain for software development. These tools run from the CLI (Command Line Interface). Out of the box you have command line restore, build, etc. These tools are the primary tools on which higher-level tools, such as Integrated Development Environments (IDEs), editors and build orchestrators can build on. The tools set in extendable on project level. That means that you can add tools in the context of your project by adding it to your project file. The tool you want to run with the from the CLI is called a verb (dotnet-verb). Running a verb is done by: dotnet verb.
Continue reading “Make a .NET Core CLI Extensions”