Archive for the .NET Core category

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
Vaughan

Creating a CSV text to model custom model binder in ASP.NET Core

.NET Core

ASP.NET Core has quite a large selection of model binders built in that are able to convert http requests to simple and complex models in your actions. If there isn\’t one that matches your needs, you can always create a custom one. To show how, I\’m going to create a custom model binder that converts […]

Read more
Vaughan

Using middleware to conditionally allow endpoints

.NET Core

There are times when you have controllers or actions that are very useful for debugging issues but you don\’t really want to expose them in a production environment. One way to achieve this is to take advantage of the separation of the Endpoint Routing Middleware and the Endpoint Middleware components. Another way would be to […]

Read more

BMC logoBuy me a coffee