Deploying a Blazor Application on Azure

Introduction In this article, we will learn how to deploy an ASP.NET Core hosted Blazor application on Azure. We will use Visual Studio 2017 to publish the app and create a SQL database server on Azure to handle DB operations. Prerequisites Install the .NET Core 2.1 or above SDK from here. Install Visual Studio 2017 v15.7 or above from here. Install ASP.NET Core Blazor Language Services extension from here. An Azure subscription account. You can create a free Azure account here. Please refer to my previous article Cascading DropDownList in Blazor Using EF Core to create the application that we will be deploying in this tutorial.

Link: https://dzone.com/articles/deploying-a-blazor-application-on-azure

Customizing ASP.NET Core Part 07: OutputFormatter

In this seventh post, I want to write about, how to send your Data in different formats and types to the client. By default the ASP.NET Core Web API sends the data as JSON, but there are some more ways to send the data.
The Series Topics

Customizing ASP.NET Core Part 1: Logging
Customizing ASP.NET Core Part 2: Configuration
Customizing ASP.NET Core Part 3: Dependency Injection
Customizing ASP.NET Core Part 4: HTTPS
Customizing ASP.NET Core Part 5: HostedServices
Customizing ASP.NET Core Part 6: Middleswares
Customizing ASP.NET Core Part 7: OutputFormatter – This article
Customizing ASP.NET Core Part 8: ModelBinder
Customizing ASP.NET Core Part 9: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

About OutputFormatters
OutputFormatters are classes that turn your data into a different format to send them through HTTP to the clients. Web API uses a default OutputFormatter to turn objects into JSON, which is the default format to send data in a structured way. Other built-in formatters are an XML formatter and a plain text formatter.

Link: https://dzone.com/articles/customizing-aspnet-core-part-07-outputformatter

Customizing ASP.NET Core Part 6: Middleware

Wow, it is already the sixth part of this series. In this post, I’m going to write about middleware and how you can use them to customize your app a little more. I quickly go through the basics about middleware and then I’ll write about some more specials things you can do with middleware.
The Series Topics

Customizing ASP.NET Core Part 1: Logging
Customizing ASP.NET Core Part 2: Configuration
Customizing ASP.NET Core Part 3: Dependency Injection
Customizing ASP.NET Core Part 4: HTTPS
Customizing ASP.NET Core Part 5: HostedServices
Customizing ASP.NET Core Part 6: MiddleWares – This article
Customizing ASP.NET Core Part 7: OutputFormatter
Customizing ASP.NET Core Part 8: ModelBinder
Customizing ASP.NET Core Part 9: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

About MiddleWares
Most of you already know what middlewares are, but some of you maybe don’t. Even if you’ve used ASP.NET Core for a while, you don’t really need to know any real details about middlewares, because they are mostly hidden behind nicely named extension methods like UseMvc(), UseAuthentication(), UseDeveloperExceptionPage(), and so on. Every time you call a Use-method in the Startup.cs in the Configure method, you’ll implicitly use at least one or maybe more middlewares.

Link: https://dzone.com/articles/customizing-aspnet-core-part-6-middleware?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Customizing ASP.NET Core (Part 5): HostedServices

This fifth part of this series doesn’t really show a customization. This part is more about a feature you can use to create background services to run tasks asynchronously inside your application. Actually, I use this feature to regularly fetch data from a remote service in a small ASP.NET Core application.
The Series’s Topics

Customizing ASP.NET Core Part 1: Logging
Customizing ASP.NET Core Part 2: Configuration
Customizing ASP.NET Core Part 3: Dependency Injection
Customizing ASP.NET Core Part 4: HTTPS
Customizing ASP.NET Core Part 5: HostedServices – This article
Customizing ASP.NET Core Part 6: MiddleWares
Customizing ASP.NET Core Part 7: OutputFormatter
Customizing ASP.NET Core Part 8: ModelBinder
Customizing ASP.NET Core Part 9: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

About HostedServcices
HostedServices are a new thing in ASP.NET Core 2.0 and can be used to run tasks asynchronously in the background of your application. This can be used to fetch data periodically, do some calculations in the background, or perform some cleanups. This can also be used to send preconfigured emails or whatever you need to do in the background.

Link: https://dzone.com/articles/customizing-aspnet-core-part-05-hostedservices?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Customizing ASP.NET Core Part 4: HTTPS

HTTPS is on by default now and a first-class feature. In Windows, the certificate which is needed to enable HTTPS is loaded from the Windows Certificate Store. If you create a project on Linux and Mac the certificate is loaded from a certificate file.

Even if you want to create a project to run it behind and IIS or an NGinX webserver HTTPS is enabled. Usually you would manage the certificate on the IIS or NGinX webserver in that case. But this shouldn’t be a problem and you shouldn’t disable HTTPS in the ASP.NET Core settings.

Link: https://dzone.com/articles/customizing-aspnet-core-part-4-https?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Customizing ASP.NET Core Part 03: Dependency Injection

In the third part of this series, we’ll take a look into the ASP.NET Core dependency injection and how to customize it to use a different dependency injection container if needed.
The Series Topics

Customizing ASP.NET Core Part 01: Logging
Customizing ASP.NET Core Part 02: Configuration
Customizing ASP.NET Core Part 03: Dependency Injection – This article
Customizing ASP.NET Core Part 04: HTTPS
Customizing ASP.NET Core Part 05: HostedServices
Customizing ASP.NET Core Part 06: MiddleWares
Customizing ASP.NET Core Part 07: OutputFormatter
Customizing ASP.NET Core Part 08: ModelBinder
Customizing ASP.NET Core Part 09: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

Why Use a Different Dependency Injection Container
In the most projects, you don’t really need to use a different dependency injection Container. The DI implementation in ASP.NET Core supports the basic features and works well and pretty fast. Anyway, some other DI containers support some interesting features you may want to use in your application.

Link: https://dzone.com/articles/customizing-aspnet-core-part-03-dependency-injecti?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Customizing ASP.NET Core Part 2: Configuration

This second part of the blog series about customizing ASP.NET Core is about the application configuration, how to use it, and how to customize the configuration to use different ways to configure your app.
The Series Topics

Customizing ASP.NET Core Part 01: Logging
Customizing ASP.NET Core Part 02: Configuration
Customizing ASP.NET Core Part 03: Dependency Injection
Customizing ASP.NET Core Part 04: HTTPS
Customizing ASP.NET Core Part 05: HostedServices
Customizing ASP.NET Core Part 06: MiddleWares
Customizing ASP.NET Core Part 07: OutputFormatter
Customizing ASP.NET Core Part 08: ModelBinder
Customizing ASP.NET Core Part 09: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

Configure the Configuration
As well as the logging, since ASP.NET Core 2.0 the configuration is also hidden in the default configuration of the WebHostBuilder and not part of the Startup.cs anymore. This is done for the same reasons to keep the Startup clean and simple:

Link: https://dzone.com/articles/customizing-aspnet-core-part-2-configuration?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Customizing ASP.NET Core, Part 1: Logging

In this first part of the new blog series about customizing ASP.NET Core, I will show you how to customize logging. The default logging only writes to the console or to the debug window. This is quite good for most cases, but you may need to log to a sink, like a file or a database. Maybe you want to extend the logger with additional information. In those cases, you need to know how to change the default logging.
The Series Topics

Customizing ASP.NET Core Part 01: Logging
Customizing ASP.NET Core Part 02: Configuration
Customizing ASP.NET Core Part 03: Dependency Injection
Customizing ASP.NET Core Part 04: HTTPS
Customizing ASP.NET Core Part 05: Hosted Services
Customizing ASP.NET Core Part 06: MiddleWares
Customizing ASP.NET Core Part 07: OutputFormatter
Customizing ASP.NET Core Part 08: ModelBinder
Customizing ASP.NET Core Part 09: ActionFilter
Customizing ASP.NET Core Part 10: TagHelpers

Configure Logging
In previous versions of ASP.NET Core (pre-2.0) the logging was configured in the Startup.cs. Since 2.0 the Startup.cs was simplified and a lot of configurations where moved to a default WebHostBuilder, which is called in the Program.cs. Also, the logging was moved to the default WebHostBuilder:

Link: https://dzone.com/articles/customizing-aspnet-core-part-1-logging?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

HTTPS Redirection Not Working after Migrating to ASP.NET Core 2.1

Enforcing HTTPS is easy with ASP.NET Core 2.1, however, if after migrating a project to 2.1 you find that it still does not work, then this article will explain what to do.
The New and Shiny
ASP.NET Core 2.1 comes with new features making it easy to enforce HTTPS. New projects are enabled by default, using UseHttpsRedirection middleware in Startup.Configure to handle the redirection.

Link: https://dzone.com/articles/https-redirection-not-working-after-migrating-to-a?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

ASP.NET Core Testing Tools and Strategies

Don’t be that developer who is woken up in the middle of the night because of some problem with the web application. After all, you need your beauty sleep – some of us more than others. The best way to avoid problems with your application is to test thoroughly. Of course, there is a cost to testing, and it is easy to jump in too deeply such that every piece of code is outrageously well tested. Finding the right balance of just what to test and which ASP.NET Core testing tools to use is something that comes with experience. Testing simple code that has a low impact too thoroughly is not as bad as failing to test complex code with a high impact, but it will still have a negative impact on the success of your project. Complicating the problem is that we have a number of ways to test code. You may be familiar with the idea of the testing triangle or, for those who think a bit higher dimensionally, the testing pyramid.

Link: https://dzone.com/articles/aspnet-core-testing-tools-and-strategies?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev