In ASP.NET Core, the method to generate a verification code along with its code is as follows: Import ZKWeb.System.Drawing, with the code sample below: /// <summary> /// Verification Code Service /// </summary> public class VerificationCode { // Ve…

2021年7月21日 0条评论 96点热度 0人点赞 痴者工良 阅读全文

在 ASP.NET Core 中生成验证码的方法以及代码: 引入 ZKWeb.System.Drawing ,其代码示例如下: /// <summary> /// 验证码服务 /// </summary> public class VerificationCode { // 验证码有效期(秒) private const int ValiditySecond = 60; // 宽、高,字体大小 private const int CodeWidth = 74;[......]继续阅读

2021年7月21日 0条评论 2659点热度 0人点赞 痴者工良 阅读全文

This article mainly introduces some binary processing classes and simple usage methods of Span in the C# namespace System.Buffers.Binary. These binary processing types form the basis for higher-level applications to handle binary data. By mastering these types…

2021年7月20日 0条评论 112点热度 0人点赞 痴者工良 阅读全文

本文主要介绍 C# 命名空间 System.Buffers.Binary 中的一些二进制处理类和 Span 的简单使用方法,这些二进制处理类型是上层应用处理二进制数据的基础,掌握这些类型后,我们可以很容易地处理类型和二进制数据之间的转换以及提高程序性能。 C# 原语类型 按照内存分配来区分,C# 有值类型、引用类型; 按照基础类型类型来分,C# 有 内置类型、通用类型、自定义类型、匿名类型、元组类型、CTS类型(通用类型系统); C# 的基础类型包括: 整型: sbyte, byte, short, ushort,…

2021年7月20日 0条评论 2596点热度 0人点赞 痴者工良 阅读全文

Introduction CZGL.ProcessMetrics is a metrics library that records information such as GC, CPU, memory, machine network, and disk space of applications, utilizes Prometheus for data collection, and displays it using Grafana. I spent Sunday updating this librar…

2021年7月18日 0条评论 68点热度 0人点赞 痴者工良 阅读全文

导读 CZGL.ProcessMetrics 是一个 Metrics 库,能够将程序的 GC、CPU、内存、机器网络、磁盘空间等信息记录下来,使用 Prometheus 采集信息,然后使用 Grafana 显示。 周日花了时间把这个库更新,修复了一些 Bug,增加了一些有趣的功能,支持多服务器多应用,支持 wpf、winfrom、.NET Core 等应用,在不需要暴露端口的情况下,也可以推送监控数据到 Prometheus,支持自定义数据源。 另外对 Grafana 模板进行了一些优化,增加了一些数据源。 根据机…

2021年7月18日 0条评论 2769点热度 0人点赞 痴者工良 阅读全文

空接口,发布者订阅者通讯,需要一个实现了 IEventData 的类。 /// <summary> /// Event Data /// </summary> public interface IEventData { } 事件,订阅者需要实现这个类型,当发布者发布一个 IEventData 类型的数据时,此事件会被触发。 当然,你也可以创建一个同步事件。 /// <summary> /// Asynchronous Event /// </summary> ///[…

2021年7月13日 0条评论 72点热度 0人点赞 痴者工良 阅读全文

空接口,发布者订阅者通讯,需要一个实现了 IEventData 的类。 /// <summary> /// 事件数据 /// </summary> public interface IEventData { } 事件,订阅者需要实现这个类型,当发布者发布一个 IEventData 类型的数据时,此事件会被触发。 当然,你也可以创建一个同步事件。 /// <summary> /// 异步事件 /// </summary> /// <typeparam name=&…

2021年7月13日 0条评论 2752点热度 0人点赞 痴者工良 阅读全文

In ControllerBase, its HttpContext is null by default. These properties depend on ControllerContext. Of course, we can also inject IHttpContextAccessor into the constructor of each controller, but that can be cumbersome. I can unify the injection through the c…

2021年7月12日 0条评论 96点热度 0人点赞 痴者工良 阅读全文

在 ControllerBase 中,其 HttpContext 的默认为空。 这些属性依赖于 ControllerContext。 当然我们也可以注入 IHttpContextAccessor,在每个控制器的构造函数中写进去,比较麻烦。我可以统一通过 控制器激活器进行统一注入。 /// <summary> /// Controller 激活器 /// </summary> public class ControllerActivator : IControllerActivator { p…

2021年7月12日 0条评论 3032点热度 0人点赞 痴者工良 阅读全文

In the backend, when there are distributed demands, we often use 64-bit numeric types to represent field types. However, the frontend does not support numeric types longer than 16 bits, so when larger long and ulong values are transmitted to the backend, their…

2021年7月12日 1条评论 114点热度 0人点赞 痴者工良 阅读全文

在后端中,当有分布式需求时,我们常常使用 64位 的数字类型表示字段类型,但是前端并不支持超过 16 位长度的数值类型,所以后端长度较大的 long、ulong 数值传到后端,其准确度就已经丢失。 解决方法就是将 ulong、long 转为字符串,传递给后端。 public class TentantQueryDto { public ulong Id { get; set; } } 这是一个后端模型, Id 为 64 位数值,我们要做到前端传递 string,自动转 ulong;后端传递 ulong,自动返回 s…

2021年7月12日 1条评论 4506点热度 0人点赞 痴者工良 阅读全文

Introduction CZGL.ProcessMetrics is a metrics library that records information about the program's GC (Garbage Collection), CPU, memory, machine network, disk space, etc. It uses Prometheus to collect this information and then displays it using Grafana. Video …

2021年7月4日 0条评论 134点热度 0人点赞 痴者工良 阅读全文

导读 CZGL.ProcessMetrics 是一个 Metrics 库,能够将程序的 GC、CPU、内存、机器网络、磁盘空间等信息记录下来,使用 Prometheus 采集信息,然后使用 Grafana 显示。 视频地址: https://www.bilibili.com/video/BV18y4y1K7Ax/ 效果图预览: 安装 ProcsssMetrics 只需要通过 Nuget 安装一个库,即可快速为程序添加资源监视。 新建一个 ASP.NET Core 应用, Nuget 中搜索 CZGL.Process…

2021年7月4日 0条评论 2790点热度 0人点赞 痴者工良 阅读全文

Remote Deployment of .NET Core/Framework to IIS via Jenkins Pipeline Introduction In this chapter, we will discuss how to compile .NET Core and .NET Framework projects on Windows Jenkins and remotely deploy them to IIS. Windows First, we need to set up the req…

2021年6月25日 0条评论 3120点热度 0人点赞 痴者工良 阅读全文

Jenkins 流水线远程部署 .NET Core/Framework 到 IIS 导读 在本章中,将会介绍在 Windows Jenkins 上,编译 .NET Core、.NET Framework 项目,以及远程部署到 IIS 中。 Windows 我们先在 Windows 上安装好相应的环境。 Jenkins 依赖于 JDK 11,请自行查找方法安装。 在 https://www.jenkins.io/download/ 中可以下载到 Windows Jenkins 版本的安装包,下载完毕后,直接安装即可,…

2021年6月25日 0条评论 3094点热度 0人点赞 痴者工良 阅读全文

目录 Introduction Deploying Jenkins Installing Plugins Pulling Images Creating Jenkinsfile Script Building Pipeline Observation Jenkins Build Automation for .NET Core Release Images Introduction In this chapter, we will introduce how to deploy and start Jenkins …

2021年6月24日 0条评论 2858点热度 0人点赞 痴者工良 阅读全文

目录 导读 部署 Jenkins 安装插件 拉取镜像 制作 Jenkinsfile 脚本 构建流水线 观察 Jenkins 构建自动化 .NET Core 发布镜像 导读 在本章中,将介绍如何在 Linux 下使用 Docker 部署、启动 Jenkins,编写脚本,自动化构建 .NET Core 应用,最终将 .NET Core 应用打包为 Docker 镜像。 部署 Jenkins 请提前在 Linux 上安装 Docker,在 Linux 中,我们使用 Docker 启动 Jenkins,这样可以避免手动安装…

2021年6月24日 0条评论 2832点热度 0人点赞 痴者工良 阅读全文

目录 Kubectl Command Overview Installing Kubernetes-Dashboard RESTful API Authentication Annotations Pod YAML Structure Configuration Kubectl Command Overview In the previous sections, we learned some Kubernetes knowledge. Now let's list all the kubectl commands…

2021年4月29日 1条评论 112点热度 0人点赞 痴者工良 阅读全文

目录 Kubectl 命令大全 安装 Kubernetes-Dashboard RESTful API 鉴权 注解 Pod YAML 结构 配置 Kubectl 命令大全 在前面,我们学习到了一些 Kubernetes 知识,现在列出 kubectl 的所有命令以及其缩写形式,供翻阅查询。 kubectl 命令格式: kubectl [command] [type] [Name] [flag] all events (ev) podsecuritypolicies (psp) certificatesigningr…

2021年4月29日 1条评论 10667点热度 0人点赞 痴者工良 阅读全文
1212223242554