Edi Wang

.NET and Azure Developer

All Posts

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 …
.NET Visual Studio

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 an exception happens. I use NLog as the logging component, so I need to use LogManager. …
.NET 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 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 production …
.NET ASP.NET

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 …
UWP

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 …
.NET ASP.NET Design Pattern Dependency Injection

Path Caveat with ASP.NET Core 2.2 IIS Hosting

ASP.NET Core 2.2 has been in place for some time, with a new feature that can use the new AspNetCoreModuleV2 and deploy with InProcess mode on IIS to dramatically improve performance. These days Azure App Service finally completed the deployment of this new version of the module, I configured my blog to the new module, and it exploded in production. Let's see why and how to solve it. If you don't …
.NET ASP.NET IIS

Automate Windows 10 Developer Machine Setup

One of the things programmers hate most is probably setup a computer. Because the programmer's computer environment configuration is very different from normal people. In general, it takes several hours to manually install a new development machine. Let this process automating, after all, the essence of programming is to let complex things simplify, find a way to be lazy! In fact, automatic …
Windows PowerShell Choco

Integrate Azure Application Insight Data into Your Own App

Microsoft Azure has a very powerful monitoring tool called Application Insights. It can monitor every aspect of our web application, including client and server metrics, error details, performance and so on. My blog is also using Application Insights, but everytime I want to see the data, I have to go to Azure portal, even for the basic metrics like page views or server response time. I want a …
Azure Application Insight