.NET Developer, Microsoft MVP

All Posts (313) 313


Send Email After Release Deployment in Azure DevOps

By default, Azure DevOps sends an email notification to team members after the compilation succeeds or fails. But in a CI/CD environment, we are more concerned about when the deployment is complete and then conducting manual or automated testing. Let's take a look at how to get Azure DevOps to automatically send mail notifications to team members after a successful deployment. Enter Project setti...

Azure DevOps

Fix .NET Core Website Failure After Deployment from Azure DevOps

I met a strange problem recently. After configure the CI/CD pipeline with Azure DevOps and automatically deploy to Azure App Services, the. NET Core Website failed to start. Let's see how we can solve this problem. Find the issue First of all, fortunately, this is a staging environment. I found that the site unexpectedly did not log anything, even log directory can not be found, which is ver...

Azure .NET Core Azure DevOps

Fix Azure DevOps TF14045 Error When Deploy to Azure

I encountered an error when I try to setup CI/CD in Azure DevOps, I tried to deploy a .NET Core application to Azure App Service, but Azure DevOps won't connect to Azure. This is a known issue for Microsoft. Let's see how we can manually setup a connection between Azure DevOps and Azure to workaround this issue. First, the error message I met was: Failed to get resource ID for resource type 'Mic...

Azure Azure DevOps Azure AD

Detect Text Language using Azure Cognitive Services in .NET Core

There are many ways to identify what is the language of a text, in this era of AI, we can also add AI capabilities to our own application. I will show you to see how to use the AI Cognitive Service provided by Microsoft Azure to detect the language of a text. The prerequisite is that you will need an Azure subscription. Create Azure Cognitive Services Account Click "Create a resouce", then se...

Azure .NET Core AI Cognitive Service

Recommended Visual Studio Configuration for .NET Core Development

Visual Studio has always been a good friend to .NET developers, although VS Code can do .NET Core development, VS is still having a lot advantages. Let's see how to make Visual Studio more handy for .NET Core development. Basic Configuration First, please be advised, not all versions of Visual Studio supports .NET Core development, even some early version of VS2017. Some people may mistake for...

Visual Studio .NET Core

ASP.NET Core Dependency Injection in ActionFilterAttribute

In ASP.NET Core, we can easily use constructor injection to make Dependent Injections on components such as Controller and ViewComponent. But how to do it with ActionFilterAttribute? The Problem My blog system has an ActionFilter for deleting subscription files, and I want to log errors when exception happens. I use NLog as the logging component, so I need to use LogManager.GetCurrentClassLogg...

.NET Core Dependency Injection

Caveats in ASP.NET Core Data Protection

ASP.NET Core provides a built in Data Protection mechanism to let us encrypt or decrypt sensitive data. There are some limitations that can cause problems while bringing convenience. I met some problems these days. My Scenario My blog system has a feature to send email notifications, so you need to configure an email account to let the program use that account to send mail to an administrator ...

.NET Core AES Encryption

Auto Refresh Settings Changes in ASP.NET Core Runtime

In ASP.NET Core, if you modify the settings in appsettings.json, you will have to restart the site to take effect. Is there a way to refresh and apply it automatically after you modify the settings? Background Let's take a look at a website created by ASP.NET Core default templates. It includes two settings files: appsettings.json appsettings.Development.json The former one is used in pro...

ASP.NET .NET Core

How to Remove Default FDS Effects in UWP Apps

The Fluent Design System introduced by Windows 10 from v1709 is very beautiful, the latest v1809 further refined FDS, many UWP built in controls got FDS effect by default while developers do not need to do anything. This is usually a good thing, but it can also cause performance problems for some apps. My Character Map UWP is one of the victimized apps, and let's take a look at how to remove the d...

UWP FDS

Dependency Injection with Multiple Implementations in ASP.NET Core

The built-in Dependency Injection (DI) in ASP.NET Core is very useful, but how do you deal with an interface has multiple implementations? Can the runtime choose one of these implementations based on configuration? Is there a way to get rid of reflection? Let me show you how to dynamically select a specific implementation of an interface at run time according to the configuration file without refl...

ASP.NET .NET Core DI Design Pattern