1072 热度

A .NET 5.0 Guide: From Idea To NuGet Package

As technology evolves and we progress as a community, I notice that older blog posts erode in their helpfulness. One of the topics I find myself constantly having to relearn, especially as an OSS author, is the ability to start a new project, build a continuous integration pipeline, and get my package to NuGet. It’s essential to understand how to design a workflow that works with your project, and in this post, we’ll take a step-by-step walkthrough of how to do just that.

收录时间: 2021-11-30
分类: .NET 5
贡献者: Rector
1328 热度

.NET 5.0 - Connect to MySQL Database with Entity Framework Core

In this post we'll go through the steps to connect a .NET API to MySQL using Entity Framework Core, and to create a MySQL database from code using EF Core migrations. We'll start with an example .NET CRUD API from a tutorial I posted recently, it uses an EF Core InMemory database by default for testing, we'll update it to connect to a MySQL database and run EF Core migrations to auto generate the database and tables from code. For full details about the .NET CRUD API see .NET 5.0 - CRUD API Example and Tutorial.

收录时间: 2021-10-27
分类: .NET 5
贡献者: Rector
1686 热度

.NET5修改配置不重启自动生效

.NET Core,.NET5默认配置都是只加载一次,修改配置时都需要重启才能生效,如何能修改即时生效呢,下面来演示一遍。

收录时间: 2021-09-18
分类: .NET 5
贡献者: Rector
1467 热度

Writing logs into Elastic with NLog , ELK and .Net 5.0 (Part 2)

In the previous article I demonstrated how we can write our log in our dotnet applications into Elastic with NLog, if you haven't read that article, I highly recommend reading it first.

收录时间: 2021-08-13
分类: .NET 5
贡献者: Rector
1936 热度

Working with multiple databases using .Net 5.0 and Entity Framework Core 5.0

The first question definitely comes in mind, why use multiple databases ? Well it is good to have database vendor independent backend so that you can swap it out whenever it is required. Or you may have a client who wants their data in a particular database vendor. That’s where ORM comes into picture. ORM like Entity-Framework allows you to talk to multiple database with ease. This article is about using Entity Framework to achieve this and I can say it is very very simple. Shall we start ? Here we taking SQL Server and Postgres DB as an example.

收录时间: 2021-08-09
分类: .NET 5
贡献者: Rector
2327 热度

Background Tasks Made Easy With Hangfire And .Net 5

In this article we will learn about the Hangfire — .Net Library to make our background tasks and jobs easier in ASP.NET 5.0. As we all know, its newly launched Framework officially released in November. Here I am sharing the link to install the SDK for .Net 5

收录时间: 2021-08-09
分类: .NET 5
贡献者: Rector
AD 友情赞助
1556 热度

Writing logs into Elastic with NLog , ELK and .Net 5.0

In this article, I'm going to use NLog to write my .Net 5.0 web application logs into Elastic. after that, I will show you how you can monitor and search your logs with different filters by Kibana.

收录时间: 2021-08-05
分类: .NET 5
贡献者: Rector
1342 热度

Migration of Bing’s Workflow Engine to .NET 5

Bing runs one of the world’s largest, most complex, highly performant, and reliable .NET applications. This post discusses the journey and the work required to upgrade to .NET 5, including the significant performance gains we achieved.This application sits in the middle of the Bing architecture...

收录时间: 2021-06-16
分类: .NET 5
贡献者: Rector
2650 热度

.NET 5.0 API - JWT Authentication with Refresh Tokens

In this tutorial we'll go through an example of how to implement JWT (JSON Web Token) authentication with refresh tokens in a .NET 5.0 API. Authentication is implemented with JWT access tokens and refresh tokens. On successful authentication the API returns a short lived JWT access token that expires after 15 minutes, and a refresh token that expires after 7 days in an HTTP Only cookie. The JWT is used for accessing secure routes on the API and the refresh token is used for generating new JWT access tokens when (or just before) they expire.

收录时间: 2021-06-16
分类: .NET 5
贡献者: Rector
1588 热度

.NET 5.0 - Global Error Handler Tutorial

This is a quick post to show how to implement a global exception handler in .NET 5.0. These are the main pieces involved in the error handling process that we'll cover in this tutorial: Global Error Handler Middleware - custom middleware that catches all exceptions and determines...

收录时间: 2021-05-31
分类: .NET 5
贡献者: Rector
1852 热度

.NET 5.0 API - Allow CORS requests from any origin and with credentials

This is a quick post to show how to configure a .NET 5.0 API to allow CORS requests from any origin as well as with credentials. I received the following error after setting credentials: 'include' for CORS requests sent from a React app to a .NET 5.0 API running on a different domain, and configuring CORS on the API to .AllowAnyOrigin() and .AllowCredentials().

收录时间: 2021-05-27
分类: .NET 5
贡献者: Rector
1778 热度

.NET 5.0 - Simple API for Authentication, Registration and User Management

In this tutorial we'll go through an example .NET 5.0 API that supports user registration, login with JWT authentication and user CRUD operations. The API is configured to use a local SQLite database in development and a SQL Server database in production. It uses Entity Framework Core migrations to automatically generate the database on startup, for more info on EF Core migrations see...

收录时间: 2021-05-26
分类: .NET 5
贡献者: Rector
1881 热度

IIS部署.Net5全流程

Internet Information Services (IIS) 是一种灵活、安全且可管理的 Web 服务器,用于托管 Web 应用(包括 ASP.NET Core)。虽然我们的程序可以跨平台了,不过还是有些服务是部署在windows服务器下的,下面我们就从头开始部署下我们的程序到IIS.

收录时间: 2021-05-20
分类: .NET 5
贡献者: Rector
2208 热度

发布 .NET 5 带运行时单文件应用时优化文件体积的方法

自 .NET 发布起,.NET Framework 运行环境就是其摆脱不掉的桎梏。后来有了 .NET Core ,微软终于将自带运行时和单文件程序带给了我们。即便如此,大部分情况下开发者仍然不太满意:一个简简单单的控制台应用程序,甚至只包含一个 Hello World ,附带运行时的单文件程序打包出来就需要 20M+ 。.NET 程序的发布受一个名为 发布配置文件 (.pubxml) 的 XML 文件控制,该文件默认不存在,会在第一次在 Visual Studio 中执行发布时创建。该文件会被保存在项目的 Properties/PublishProfiles 目录下,可以在以下微软文档上看到更详细的介绍...

收录时间: 2021-05-17
分类: .NET 5
贡献者: Rector
1313 热度

Docker 部署net5程序

本文讲述使用docker容器部署.net5项目、实现跨平台。 部署环境:docker 容器、liunx系统、这里采用VmWare虚拟机、并采用MobaXterm工具实现终端连接linux系统...

收录时间: 2021-05-17
分类: .NET 5
贡献者: Rector
AD 友情赞助
1849 热度

Create A Zip File With .NET 5

Zip files are the most ubiquitous compression format in computing history, with it first being invented in 1986 by Phillip Katz. Since then, the Zip file has found its way into every operating system as the de facto compression method. It’s only right that .NET developers become familiar with the format and have the necessary tools to work with these files programmatically. In this post, we’ll look at the ZipFile utility class, how to compress files and directories, along with decompressing zip files.

收录时间: 2021-03-17
分类: .NET 5
贡献者: Rector
1788 热度

Multi-stage Docker builds for ASP.NET Core 5

I am building an app with .NET 5 and ASP.NET Core 5. And, I want to run it on a cloud provider. Since .NET 5 isn't widely adopted yet (and probably won't be since it's not an LTS version), that means the easiest path to deployment is a Docker image. That part isn't hard. When you create a new .NET project, you get a multi-stage Dockerfile for free (well, as long as you select that option). But, I want to use vanilla Node.js build options for processing and bundling my CSS and JS files. The common solutions I've seen for Docker + Node + .NET involve starting with the base .NET image and then using apt-get to install Node. I didn't want to go down that path if I could help it. I don't know why, but the idea of modifying the Docker image outside of just building stuff offended my aesthetic.

收录时间: 2021-03-01
分类: .NET 5
贡献者: Rector
1474 热度

Experimenting with .NET 5 and 6 using Docker containers

The .NET team publish Docker images for every release of the .NET SDK and runtime. Running .NET in containers is a great way to experiment with a new release or try out an upgrade of an existing project, without deploying any new runtimes onto your machine.

收录时间: 2021-02-24
分类: .NET 5
贡献者: Rector
1608 热度

Web API with .NET 5-Debug Solutions

In this article, we will learn about RESTful WebAPI with .NET 5 (Successor of .NET Core 3.1).We will create a new WebAPI project with .NET CLI in VS CodeWe will see what’s new provided with .NET 5 WebAPI template...

收录时间: 2021-02-10
分类: .NET 5
贡献者: Rector
1536 热度

dotnet 5 静态字段和属性的反射获取-没有想象中那么伤性能

在最近在做 WPF 框架开发的时候,看到了在 WPF 的 StaticExtension 里面,有部分逻辑采用了反射的方法去获取静态字段和静态属性。此时我第一个反应就是这部分逻辑的性能有锅,于是尝试了进行加上缓存来优化。但是在使用了 Benchmark 进行性能测试的时候发现了,其实加上了缓存的性能反而更差,也就是说在 dotnet 5 里面的反射获取静态字段和属性的性能没有想象的伤性能。本文并非说反射获取静态字段和属性不伤性能,而是指在本文约定的情况下,没有那么伤性能。本文完全依靠性能测试来说明。

收录时间: 2021-01-27
分类: .NET 5
贡献者: Rector
AD 友情赞助