Roland Guijt

Hello. I am Roland Guijt. I'm a Microsoft MVP, international speaker, consultant and trainer specializing in cloud and web technology.

Endpoint Routing in ASP.NET Core 2.2 Explained

The ASP.NET Core team is hard at work making ASP.NET Core better and more performant with each release. An enhancement in 2.2 is endpoint routing. Here's how it works. In pre-2.2 versions routing is done at the MVC level. A URL that hits the app is interpreted and mapped to the right controller and action according to the configuration you do in the routing table or with routing attributes. All the work is done in the MVC middleware. This has a drawback. Because this is at the MVC level other middlewares don't have a clue at which endpoint the request will arrive. That is especially a problem with a middleware like the one we have for...

Pluralsight Course "Understanding ASP.NET Core 2.x" Updated

My Pluralsight course about ASP.NET Core 2 is one of the most popular courses I have. Many people have already watched it and I'm thrilled about the very positive feedback I'm getting about it. There is 2.x in the title so the intention of the course is that I'm updating it as ASP.NET Core minor versions come out. Since the course was created when 2.0 was released I have now updated it to reflect version 2.1. Maybe you're thinking: that's a bit late. Well I finished the updates about 4 weeks ago (I'm writing this on 20 July). During these 4 weeks I've been busy getting Pluralsight to publish the updates. I'm told the team...

Writing APIs in ASP.NET Core 2.1 with the ApiController Attribute

APIs Writing Apis in ASP.NET Core until version 2.0 for me has been a great experience. I love the fact that we can now just use the same framework for both web applications and APIs. It's great to use the same Controller base class but fact remains that a Controller for an API has different needs in terms of functionality than a Controller for an MVC application that works with views. The ApiController attribute adds some great functionality to ASP.NET Core 2.1 controllers that makes life easier for API developers. Attribute routing The ApiController attribute offers a couple of very nice advantages but first a heads-up. When using an api controller you have to use attribute...

Scaling Out Your ASP.NET Core SignalR Application

Load balancers When you deploy your app to production at some point you'll want to scale out. Scaling out means running the app on multiple servers. When the app runs in the cloud scaling out is a matter of setting the number of servers you want to run. A mechanism called a load balancer will then pick a server on each incoming request. The load balancer can pick a different server in sequence or have some other logic going on to pick one. WebSockets When using web sockets there is no problem. Once the web socket is established it is like a tunnel between one server and the browser. But when using polling or long polling there might be a...

Retrieving a Secret from Azure KeyVault: Easiest Example Ever

The internet is full of code examples that try to show all possible features of Azure KeyVault. I felt the need for a very basic example just retrieving a secret. Here it is. It's an ASP.NET Core console application with a couple of added NuGet packages: Microsoft.IdentityModel.Client.ActiveDirectory (for access token retrieval from Azure Active Directory (AAD) Microsoft.Azure.KeyVault Microsoft.Extensions.Configuration (to access the appsettings.json file with needed settings) Setup steps in Azure: Authentication in Key Vault works via Azure Active Directory (AAD). We first have to set that up. AAD steps Login to the Azure portal Go to Azure Active Directory Go to App registrations Click "New application registration" Select a...

Using React's new context API

Why context? A component tree can quickly grow. The root component has many children, the children have many children and so on. What if you want to pass information that is considered global to a tree or subtree of components? For example what language these components should use. Or what the username is. You could use props of course, but it seems unnessary to pass on the same information over and over again to each component. This is where the context comes in. Pre context In this example from the React website no context is used. The theme with value dark is passed with a prop to the child toolbar component which passes it on to it's child ThemedButton also...

Setting Up a React Development Environment

Preparation First make sure that you have the latest version of node.js installed. The easiest way to do that is to download the installer package from nodejs.org. npm is the node package manager. It is updated more frequently than node itself. To make sure your have the latest version, at the prompt type npm install npm@latest -g. Create-react-app Now change to the root folder where you want the app to live and type npx create-react-app [yourapp] to create the initial app. npx was installed when we installed npm. It executes an npm package directly. It downloads a starting point for an application using the latest version of React. Besides that it configures a complete environment to develop...

.NET Standard Explained: How the table works

It took me a while to get my head around the new .NET Standard which is going to affect the monikers that are going to be used in ASP.NET Core. I felt the need to simplify it as much as possible primarily to help me remember how it works :-) Portable Class Libraries The .NET Standard can be seen as the next version of portable class libraries (PCLs). The main disadvantage of a PCL is that it is tied up front to one or more .NET platforms. You see the .Net platforms listed in the first column of the table below. Imagine you create a PCL now and configure it to support Silverlight and .Net Framework 4.6. Then...