<?xml version="1.0" encoding="utf-16"?><rss version="2.0"><channel><title>HueiFeng</title><description>冯辉,HueiFeng,.NET,.NET Core,Docker,k8s</description><link>https://hueifeng.azurewebsites.net/</link><pubDate>Tue, 07 Apr 2026 17:54:51 GMT</pubDate><copyright>(c) {year} Moonglade</copyright><generator>Moonglade v11.2-preview</generator><item><title>【Azure DevOps系列】Azure DevOps构建.NET EFCore应用程序</title><link>https://hueifeng.azurewebsites.net/post/2021/5/30/azure-devopsazure-devopsnet-efcore</link><description>本章我们将看到如何通过Azure DevOps使用EFCore CLI工具将我们的EFCore应用程序进行数据库重建，当然这种操作我不建议使用，建议使用CLI生成sql脚本形式进行发布并迁移。
设置代理服务器sdk
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '3.x'
安装dotnet-ef
安装Entity Framework Core CLI工具，用于后面对数据库的操作
- task: CmdLine@2
  displayName: 'install dotnet-ef'
  inputs:
    script: 'dotnet tool install -g dotnet-ef'
删除数据库
 dotnet ef database drop --project &lt;path to your …</description><author>695979933@qq.com</author><category>.NET</category><category>.NET5</category><category>ASP.NET CORE</category><category>Azure</category><category>ASP.NET Core 5.0</category><guid isPermaLink="false">6B08EC4E-24A5-4BB3-ADF7-F8D07619F5C1</guid><pubDate>Sun, 30 May 2021 04:46:38 GMT</pubDate></item><item><title>在ASP.NET Core中使用ViewComponent</title><link>https://hueifeng.azurewebsites.net/post/2021/4/10/using-viewcomponents-in-asp-net-core</link><description>前言
在之前的开发过程中，我们对于应用或者说使用一些小的组件，通常使用分布页（partial view），再往前在Web Form中我们会进行应用WEB Control，好吧提及一个关键性代码TagPrefix：TagName，通过这种的标记我们便可以在我们web form中进行引入我们的组件，当然自从.NET MVC之后呢，就已经没有了WebControl，而对于.NET Core后，又多了一个特性ViewComponent。
对于ViewComponent看起来它类似于小的控制器，而对于我们小的组件或者小部分通用型功能，可通过ViewComponent进行实现，比如说留言栏、菜单等等。
ViewComponent是由两部分组成，一部分是类（通常该类集成与ViewComponent），而另外一部分是视图（Razor和普通的View一样），当然ViewComponent同样也支持POCO， …</description><author>695979933@qq.com</author><category>ASP.NET MVC</category><category>.NET</category><category>ASP.NET CORE MVC</category><category>.NET5</category><category>ASP.NET CORE</category><category>ASP.NET Core 5.0</category><guid isPermaLink="false">A4118DBF-0C7B-4658-9017-F8498E038D60</guid><pubDate>Sat, 10 Apr 2021 03:40:30 GMT</pubDate></item><item><title>.NET初探源代码生成（Source Generators）</title><link>https://hueifeng.azurewebsites.net/post/2021/3/16/generating-code-in-dotnet</link><description>前言
Source Generators顾名思义代码生成器，可进行创建编译时代码，也就是所谓的编译时元编程，这可让一些运行时映射的代码改为编译时，同样也加快了速度，我们可避免那种昂贵的开销，这是有价值的。
实现ISourceGenerator
集成ISourceGenerator接口，实现接口用于代码生成策略，它的生命周期由编译器控制，它可以在编译时创建时创建并且添加到编译中的代码，它为我们提供了编译时元编程，从而使我们对C#代码或者非C#源文件进行内部的检查。
    [Generator]
    class CustomGenerator: ISourceGenerator
    {
        public void Initialize(GeneratorInitializationContext context)
        {
            throw …</description><author>695979933@qq.com</author><category>.NET</category><category>.NET5</category><category>ASP.NET CORE</category><guid isPermaLink="false">88056697-3937-49EA-9257-07B3FEA3F28F</guid><pubDate>Tue, 16 Mar 2021 12:43:48 GMT</pubDate></item><item><title>.NET探索模型路由约定实现伪静态</title><link>https://hueifeng.azurewebsites.net/post/2021/2/19/dotnet-implement-url-rewrite</link><description>概述
IPageRouteModelConvention接口用于自定义PageRouteModel，这个对象在Microsoft.AspNetCore.Mvc.ApplicationModels命名空间中，
代表着Razor Page路由设置，换句话说我们可以通过实现该接口覆盖默认的实现。
该接口需要实现一个成员void Apply(PageRouteModel model)。通过这个方法，我们可以访问有关当前路由设置的元数据，并根据需要对其内容进行修改。
下面示例，将解决提供一个伪静态的解决方案，因此我们可以通过index.html about.html....去访问我们的页面，也就是说我们可以从Index-Index.html的支持
    public class HtmlExtensionPageRouteModelConvention : …</description><author>695979933@qq.com</author><category>.NET</category><category>.NET5</category><category>ASP.NET CORE</category><category>ASP.NET Core 5.0</category><guid isPermaLink="false">7946ECA2-A86C-4CE0-AB9E-0FCC73CBDFA6</guid><pubDate>Fri, 19 Feb 2021 10:49:28 GMT</pubDate></item><item><title>Vs编译时RazorTagHelper - DOTNET_HOST_PATH is not set</title><link>https://hueifeng.azurewebsites.net/post/2020/11/17/vs-razortaghelper-dotnethostpath-is-not-set</link><description>今天听朋友说遇到一个问题，打开一个aspnetcore2.2的项目工程，发现挺有意思，缺少环境变量DOTNET_HOST_PATH
file
严重性	代码	说明	项目	文件	行	禁止显示状态
错误	MSB4018	“RazorTagHelper”任务意外失败。
System.InvalidOperationException: DOTNET_HOST_PATH is not set
   在 Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.get_DotNetPath()
   在 Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.GenerateFullPathToTool()
   在 Microsoft.Build.Utilities.ToolTask.ComputePathToTool() …</description><author>695979933@qq.com</author><category>ASP.NET CORE MVC</category><category>ASP.NET CORE</category><guid isPermaLink="false">82DC7BE7-292B-48F4-9192-82128D27D220</guid><pubDate>Tue, 17 Nov 2020 12:26:11 GMT</pubDate></item><item><title>.NET必知的EventCounters性能指标监视器</title><link>https://hueifeng.azurewebsites.net/post/2020/11/14/dotnetnet-eventcounters-performance-monitor</link><description>在.NET我们对于性能指标监控，其实常见的有两个方法，一个是CLI工具dotnet-counters而另一个是代码级别的EventListener.
使用dotnet-counters
dotnet-counters是一个性能指标监视工具，用于临时运行状态监视和初级性能调查。它可以观察通过 EventCounter API发布的性能计数器值。例如，可以快速监视 CPU 使用情况或 .NET Core 应用程序中引发的异常率，以了解在使用 PerfView 或 dotnet-trace 深入调查更严重的性能问题之前是否有任何可疑操作。
-- 摘自 dotnet-counters
命令
dotnet-counters collect
dotnet-counters list
dotnet-counters monitor
dotnet-counters ps
安装dotnet- …</description><author>695979933@qq.com</author><category>.NET</category><category>.NET5</category><category>ASP.NET CORE</category><category>ASP.NET Core 5.0</category><guid isPermaLink="false">58CB71A2-CEB8-4440-9E9E-07402CB850AF</guid><pubDate>Sat, 14 Nov 2020 03:03:26 GMT</pubDate></item><item><title>【Azure DevOps系列】Azure DevOps多阶段构建</title><link>https://hueifeng.azurewebsites.net/post/2020/10/28/azureops-multi-stage-continuous-deploy</link><description>对于阶段的流水线其实是特别有用的，我们可以将构建、测试、或者说部署分为多个阶段进行处理。将您的应用程序部署到多个环境中，并从一个环境逐步过渡到另一个环境。例如，可以在CI中运行单元测试后自动部署到Dev环境，然后部署到运行集成测试的Test环境，然后手动部署到Production。
管道任务
这是一个最基础的管道任务，它在Microsoft托管代理上运行，同时他它采用ubuntu-16.04虚拟机镜像，执行后将会输出Hello world
pool:
  vmImage: 'ubuntu-16.04'
steps:
- bash: echo Hello world
当然我们可以对此进行修改成如下方式：
jobs:
- job: myJob
  timeoutInMinutes: 10
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - …</description><author>695979933@qq.com</author><category>ASP.NET CORE</category><category>DevOps</category><guid isPermaLink="false">737F4DF2-11C3-4A15-8FC1-846DC0C8BE65</guid><pubDate>Wed, 28 Oct 2020 01:43:10 GMT</pubDate></item><item><title>.NET Core开源导入导出库 Magicodes.IE 2.3发布</title><link>https://hueifeng.azurewebsites.net/post/2020/9/21/announcing-magicodesie--2-3</link><description>在2.3这一版本的更新中，我们迎来了众多的使用者、贡献者，在这个里程碑中我们也添加并修复了一些功能。对于新特点的功能我将在下面进行详细的描述，当然也欢迎更多的人可以加入进来，再或者也很期待大家来提issues或者PR，您的一个issue或者PR将是我们前进的动力。
file
公式导出 #88
公式导出目前已经在Excel模板导出中支持，我们可以通过如上代码片段的格式进行将公式应用到我们的Excel导出模板中.
{{Formula::AVERAGE?params=G4:G6}}
{{Formula::SUM?params=G4:G6G4}}
增加分栏、分sheet、追加rows导出 #74
在该版本中我们支持使用链式编程导出我们的Excel，从而起到追加分栏等作用。
在多个DTO导出中我们可以通过如下代码片段将我们的Excel分栏导出
exporter.Append(list1). …</description><author>695979933@qq.com</author><category>.NET</category><category>ASP.NET</category><category>ASP.NET CORE</category><guid isPermaLink="false">549DED6B-C9C2-478D-90CF-D5E1A1CA0D7B</guid><pubDate>Mon, 21 Sep 2020 13:47:05 GMT</pubDate></item><item><title>【Azure DevOps系列】使ASP.NET Core应用程序托管到Azure Web App Service</title><link>https://hueifeng.azurewebsites.net/post/2020/9/11/aspnet-core-azuredevops-web-app-service</link><description>使用Azure DevOps Project设置ASP.NET项目
file
我们需要先在Azure面板中创建一个Azure WebApp服务，此处步骤我将省略，然后点击部署中心如下图所示：
file
此处我选择的是Azure Repos，当然大家也可以选择Github、Local Git、FTP
file
我们需要提前在Azure DevOps中提前创建好应用程序，我这边已经提前创建好了名称为Blog
.
file
创建完后我们会在Azure DevOps Pipeline中看到默认为我们生成的管道信息，他是一个构建刚才那个应用程序并发布的过程。这个过程还是挺方便的，省去了我们一些的配置直接将这些给我们配置好，当然CD其实也配置好了，最终这个应用程序会发布到我们在在这之前创建的Azure WebApp中。
file
file
通过如下该图我们可以看到已经可以访问通了，虽然
为错误页面其实 …</description><author>695979933@qq.com</author><category>ASP.NET CORE</category><category>DevOps</category><guid isPermaLink="false">0BE62125-0712-47DC-9D8D-BFD63C74483B</guid><pubDate>Fri, 11 Sep 2020 04:59:08 GMT</pubDate></item><item><title>【Azure DevOps系列】Azure DevOps构建并发布Nuget程序包</title><link>https://hueifeng.azurewebsites.net/post/2020/9/7/azure-devops-nuget-publish</link><description>在Azure DevOps中，管道可以用来构建解决方案，O(∩_∩)O哈哈~快万能了，本章主要介绍如何创建Nuget包并且将其发布到Nuget服务器的过程。
file
前面我创建了一个非常简单的类库，这边我不做过多叙述，接下来我们需要进行编辑csproj文件，当我们创建Nuget包时，我们将使用dotnet pack命令。这于传统的Nuget cli稍微有点不同，在传统的Nuget CLI中，我们创建nuspec文件并针对nuspec运行nuget pack。dotnet pack命令将从csproj创建一个nuspec文件，然后将代码打包到一个nupkg文件中，需要将一些关键信息添加到csproj文件中，以确保它可以正确的创建Nuget包。首先我们需要一个PackageId，这将是Nuget包本身的名称，根据我们要发布的位置这个名称必须是唯一的，接下来是Version，它将是已发布的软件 …</description><author>695979933@qq.com</author><category>.NET</category><category>ASP.NET CORE</category><category>DevOps</category><guid isPermaLink="false">F3D9499D-7988-4642-A900-663CF4860C83</guid><pubDate>Mon, 07 Sep 2020 01:01:46 GMT</pubDate></item><item><title>【Azure DevOps系列】Azure DevOps生成代码覆盖率</title><link>https://hueifeng.azurewebsites.net/post/2020/8/31/azure-devopsazure-devops-generation-coverage</link><description>前言
在做单元测试时，代码覆盖率可以作为我们衡量代码质量的一个指标，本章我们将使用Azure DevOps帮助我们生成代码覆盖率的结果.Azure DevOps构建管道还是具有代码覆盖率选项的，在Visual Studio测试平台在已经集成了Coverlet格式的数据收集器，它其实并不难，它是可以开箱即用的。获取Coverlet格式报告几乎都是可以拿命令行参数去解决的。
在单元测试项目中需要引入nuget包coverlet.collector，当然只需要在单元测试项目中引用他，下面这个代码片段是单元测试模板自动生成的，我只是引入了一个我自己的类库。
Project Sdk=Microsoft.NET.Sdk

  PropertyGroup
    TargetFrameworknetcoreapp3.1/TargetFramework
    IsPackablefalse/ …</description><author>695979933@qq.com</author><category>ASP.NET CORE</category><category>DevOps</category><guid isPermaLink="false">F60680D8-EDCC-4783-A123-9923DE9FB1E4</guid><pubDate>Mon, 31 Aug 2020 02:58:46 GMT</pubDate></item><item><title>【翻译】.NET 5 Preview8发布</title><link>https://hueifeng.azurewebsites.net/post/2020/8/26/net-5-preview8</link><description>今天，.NET 5预览8发布了，对于.NET5.0的功能开发已经完成了，这必须要排除待处理的bug，预览8是最后一次预览版本。预计11月正式的.NET5.0版本发布之前还将发布两个正式之前的候选版本，这篇文章描述了.NET5.0版本中的一系列功能。&lt;br /&gt;You can download .NET 5.0, for Windows, macOS, and Linux:
Installers and binaries
Container images
Snap installer
Release notes
Known issues
GitHub issue tracker
今天同时也发布了ASP.NET Core 和 EF Core 。&lt;br /&gt;要使用.NET5我们需要最新版本的 Visual Studio (包括 Visual Studio for Mac) 才能使用 .NET 5 …</description><author>695979933@qq.com</author><category>.NET5</category><category>ASP.NET CORE</category><category>ASP.NET Core 5.0</category><guid isPermaLink="false">235AD741-1314-485C-8BEB-C9528510E2FB</guid><pubDate>Wed, 26 Aug 2020 06:53:31 GMT</pubDate></item><item><title>Using ABP vNext to Develop an Address Book Application in 5 Minutes</title><link>https://hueifeng.azurewebsites.net/post/2020/8/21/using-abp-vnext-to-develop-an-address-book-application-in-5-minutes</link><description>Using ABP vNext to Develop an Address Book Application in 5 Minutes
ABP vNext framework (hereinafter called "ABP") is an artwork-level application development framework designed by Volosoft. It is based on Domain-Driven-Design (DDD) and innovatively adopts modular development design. ABP is undoubtedly the most advanced and elegant existence in ASP.NET Core development frameworks.
I believe that …</description><author>695979933@qq.com</author><category>.NET</category><category>ASP.NET CORE MVC</category><category>ASP.NET Web APi</category><category>ASP.NET CORE</category><guid isPermaLink="false">1761F88A-0D2B-4EF9-A91E-50D20D681D22</guid><pubDate>Fri, 21 Aug 2020 00:49:10 GMT</pubDate></item><item><title>ASP.Net Core 使用HttpClientFactory Polly实现熔断降级</title><link>https://hueifeng.azurewebsites.net/post/2020/8/15/aspnet-core-httpclientfactory-polly</link><description>前言
在NET Core2.1后也是增加更新了很多东西,当然HttpClientFactory更新中的一部分.虽然说HttpClient这个实现了disposable,但使用它的时候用using包装块的方式通常不是最好的选择。处理HttpClient,底层socket套接字不会立即释放。该HttpClient类是未多个请求重复使用而创建的。需要不同的基地址,不同的HTTP 标头和其他对请求个性化操作的场景时,需要动手管理多个HttpClient实例,为了简化HttpClient实例管理,.NET Core 2.1提供了一个新的HTTPClientFactory - 它可以创建，缓存和处理HttpClient实例。
什么是HttpClientFactory
从ASPNET Core开始,Polly与IHttpClientFastory集成。HttpClientFastory是一个简化管理和使 …</description><author>695979933@qq.com</author><category>ASP.NET Web APi</category><category>ASP.NET CORE</category><guid isPermaLink="false">285C2D3E-748E-421F-86FE-D83A3D10825A</guid><pubDate>Sat, 15 Aug 2020 09:07:09 GMT</pubDate></item></channel></rss>