Archive for the .NET Core category

Vaughan

Using route constraints in ASP.NET Core

.NET Core

A small but useful feature available in ASP.NET Core is to define route constraints to disambiguate similar routes. Its important to note that the documentation makes it clear that you shouldn’t be using this for input validation. The main use case is if you want different actions using the same route but business logic requires […]

Read more
Vaughan

MEASURING .NET CORE: 5. Creating and analyzing a dump file when an ASP.NET Core application crashes

.NET Core, Dotnet Tools, Measuring

This is the fifth in a series of posts covering measuring a .Net Core application. If you want to try follow the code then you can have a look at this repo: Blog-Diagnostics. This is the plan for the series. I will update this with links as it evolves. Setting up local diagnostics tools Using […]

Read more
Vaughan

Measuring .Net Core: 4. Using dotnet-gcdump to investigate memory leaks

.NET Core, Dotnet Tools, Measuring

This is the fourth in a series of posts covering measuring a .Net Core application. If you want to try follow the code then you can have a look at this repo: Blog-Diagnostics. This is the plan for the series. I will update this with links as it evolves. Setting up local diagnostics tools Using […]

Read more
Vaughan

ASP.NET Core doesn’t use a SynchronizationContext

.NET Core

Yesterday I was trying to show how to diagnose a deadlock situation when using blocking code over async. This was a pretty common mistake in ASP.NET and a nice scenario to add to my measurement series. I created a controller like this in my ASP.NET Core sample application and strangely it worked without error. [HttpGet] […]

Read more
Vaughan

Measuring .Net Core: 3. dotnet-counters with a custom provider

.NET Core, Dotnet Tools, Measuring

This is the third in a series of posts covering measuring a .Net Core application. If you want to try follow the code then you can have a look at this repo: Blog-Diagnostics. This is the plan for the series. I will update this with links as it evolves. Setting up local diagnostics tools Using […]

Read more
Vaughan

Measuring .Net Core: 2. Using dotnet-counters

.NET Core, Dotnet Tools, Measuring, Performance

This is the second in a series of posts covering measuring a .Net Core application. If you want to try follow the code then you can have a look at this repo: Blog-Diagnostics. This is the plan for the series. I will update this with links as it evolves. Setting up local diagnostics tools Using […]

Read more
Vaughan

Measuring .Net Core: 1. Setting up local diagnostics tools

.NET Core, Dotnet Tools, Measuring

This is the first in a series of posts covering measuring a .Net Core application. If you want to try follow the code then you can have a look at this repo: Blog-Diagnostics. This is the plan for the series. I will update this with links as it evolves. Setting up local diagnostics tools Using […]

Read more
Vaughan

Using a custom authorization filter in ASP.NET Core

.NET Core

In a previous post I showed how you can use custom middleware to disable endpoints based on configuration and attributes. It is a good way to show how middleware works but there is an easier way. You can achieve the same result by creating a custom authorization filter. To show how, I will first add […]

Read more
Vaughan

Using in-line middleware in ASP.NET Core

.NET Core

I previously showed how you can create your own middleware and use the app.UseMiddleware method to insert it into the pipeline. For simple cases you can create inline middleware right in your Startup.Configure method. There are three options available. Use: This can enrich a request context as it passes through the pipeline. app.Use(async (context, next) […]

Read more
Vaughan

Authenticating to IdentityServer4 in ASP.NET Core

.NET Core, IdentityServer4, OAuth

Authenticating to an IdentityServer4 service with an ASP.NET Core application is actually quite easy once you see it. It does require a basic understanding of the OpenID framework though. I’m first going to explain some basics and then I’ll show the code at the end. IdentityServer4 will expose a set of endpoints that a client […]

Read more

BMC logoBuy me a coffee