3 热度

.Net Core官方的 JWT 授权验证

什么是JWT?JSON Web令牌(JWT)是一个开放标准(RFC 7519),它定义了一种紧凑且自包含的方式,用于在各方之间安全地传输信息作为JSON对象。由于此信息是经过数字签名的,因此可以被验证和信任。可以使用秘密(使用HMAC算法)或使用RSA或ECDSA的公钥/私钥对对JWT进行签名。尽管可以对JWT进行加密以提供双方之间的保密性,但我们将重点关注已签名的令牌。签名的令牌可以验证其中包含的声明的完整性,而加密的令牌则将这些声明隐藏在其他方的面前。当使用公钥/私钥对对令牌进行签名时,签名还证明只有持有私钥的一方才是对其进行签名的一方。由于缺乏安全性,所以不能把如密码等敏感信息放在令牌中...

收录时间: 2020-12-01
分类: .NET Core
贡献者: Rector
4 热度

C#设计模式之适配器模式

适配器模式,简单来说,就是将一个类的接口转换为另外一个类的接口,使得原本由于接口不兼容而不能一起工作的那些类能够一起工作。在现实生活中,这种例子也很多,比如我们如果买的是港行的电器,比如港版的iPhone,英版的原版树莓派,那么自带的充电器插头可能就是英标,在国内不能直接使用,国标的插头间距跟英标不兼容,所以,就需要一个适配器。

收录时间: 2020-12-01
分类: 设计模式
贡献者: Rector
3 热度

asp.net core 集成 Prometheus

Prometheus 是一个开源的现代化,云原生的系统监控框架,并且可以轻松的集成 PushGateway, AlertManager等组件来丰富它的功能。对于 k8s 下部署的系统来说使用 Prometheus 来做系统监控会是一个比较不错的选择,我们现在正在使用的模式就是应用暴露 metrics 信息给 Prometheus,然后使用 Grafana 做展示。

收录时间: 2020-12-01
分类: ASP.NET Core
贡献者: Rector
2 热度

c#使用csredis操作redis

现在流行的redis连接客户端有StackExchange.Redis和ServiceStack.Redis,为什么选择csredis而不是这两个?.net 最有名望的 ServiceStack.Redis 早已沦为商业用途,在 .NETCore 中使用只能充值;后来居上的 StackExchange.Redis 虽然能用,但线上各种 Timeout 错误把人坑到没脾气,两年多两年多两年多都不解决,最近发布的 2.0 版本不知道是否彻底解决了底层。csredis支持.net40/.net45/.netstandard2.0,基本上满足了常见运行平台,而上面两个基本已经放弃.net40了...

收录时间: 2020-12-01
分类: Redis
贡献者: Rector
2 热度

一套标准的ASP.NET Core容器化应用日志收集分析方案

本文记录一套标准的、无侵入的的容器化应用日志收集方案:1.什么样的日志应该被收集?2.如何输出为结构化日志?3.使用EFK无侵入的收集分析日志...

收录时间: 2020-12-01
分类: ASP.NET Core
贡献者: Rector
2 热度

Unit tests in Entity Framework Core 5

Tests are an integral part of software development. These are separate programs that allow you to check if a piece of the program written by us does exactly what it should. Unit tests are small pieces of code that test individual program elements and in Entity Framework Core 5 it’s surprisingly easy to write them.

收录时间: 2020-12-01
贡献者: Rector
AD 友情赞助
29 热度

(原创)用.NET Core实现一个在线客服系统(上篇)

没有视频的介绍显得尤为空白仓促。所以,如果你不赶时间,看看视频先→ → 戳我看视频 ← ←  在线演示访客端:http://role.fuyue.xyz/visitor/index客服端:http://role.fuyue.xyz/什么?网速不行?流量不够?那好吧,马赛克画质动态图拿走~看到这里,相信看官你一定已经知道了这个系统的作用了。在线接客(或者可以说是为产品售前、售后以及各种人性化的服务)。这时候有人会问,你这个看起来就是一个普通的聊天功能啊,有什么好介绍的呢,为什么要重复造这个轮子呢?嗯?为什么是个好问题。→ →(其实就是头脑一发热,它。。它 。。。就出来了)。好了,言归正传,这...

收录时间: 2020-11-28
分类: .NET Core
贡献者: Rector
24 热度

Getting Started With Entity Framework Core 5

In this post, we’ll see how we can get started with EF Core 5. We’ll design a schema for entertainment productions using a code-first approach, migrate an SQLite database to our schema’s current incarnation, seed our database, and run some typical LINQ queries.

收录时间: 2020-11-28
贡献者: Rector
25 热度

Development With A Dot - Inline Images with ASP.NET Core

The most common way to show an image in an HTML page is to use the tag to load an external resource. Another option is to use a URL that is a Base64encoded version of the image. There are some aspects worth considering:Using this approach the HTML will become larger, because it will also contain the...

收录时间: 2020-11-28
分类: ASP.NET Core
贡献者: Rector
33 热度

Announcing Microsoft Q&A for .NET

Have you ever been working on some code and ran into an issue and needed to ask someone for help? Maybe you are looking for assistance on how to start your next app or perhaps you are seeking some architecture guidance? What if there were one place where you could go to get your technical questions answered by experts from Microsoft and the community? Well there is now with the launch of Microsoft Q&A for .NET!

收录时间: 2020-11-27
分类: .NET
贡献者: Rector
36 热度

Blazor JavaScript Isolation, Modules, and Dynamic C#

This post will describe enhancing the existing Blazor API using extension methods to make importing JavaScript modules clearer. We’ll create a new type that will allow us to write C# code that looks similar to its JavaScript counterparts.

收录时间: 2020-11-26
分类: Blazor
贡献者: Rector
28 热度

Upgrading several of my Applications and Libraries to .NET 5.0

After .NET 5.0's release a couple of weeks ago, I went through all of my personal/company .NET Core 3.1 applications and upgraded them to .NET 5.0. In the past upgrades to major versions have been pretty painful or downright torturous, but with this update to .NET 5.0 (note that 5.0 drops the Core moniker) I'm happy to say that it's been the easiest migration of any major .NET version update that I can remember.

收录时间: 2020-11-26
分类: .NET Core
贡献者: Rector
33 热度

Custom Validation in Blazor WebAssembly

In our Blazor WebAssembly series, we’ve already talked about Forms and Form Validation. There we learned a lot about creating and validating forms but there is still more to it. In this article, we are going to extend that topic by introducing a custom validation in Blazor WebAssembly. We are going to learn how to add custom validation attributes and use them for our model objects. Also, we are going to see how to customize our error messages and how to customize the style of the input elements on the form.

收录时间: 2020-11-26
分类: Blazor
贡献者: Rector
35 热度

Uno Platform Webcast: What’s new with Uno Platform, .NET 5 and WinUI 3 Preview 3

On December 17th we will hold our first office-hours-style webinar to tell you all about our support for .NET 5 and WinUI 3 Preview 3. Register now. Adding support for .NET 5 in Uno Platform creates multiple opportunities to improve performance and reduce solution complexity. With .NET 5, we can better target traditional Microsoft Windows targets, but also WebAssembly, Linux, macOS, iOS and Android.

收录时间: 2020-11-26
分类: .NET 5
贡献者: Rector
22 热度

Implementing a Custom TypeConverter In Razor Pages

In my most recent article, I showed how to create a custom model binder to bind an ISO 8601 string representation of a week of the year to a DateTime type in a Razor Pages application. The custom model binder leant heavily on the existing infrastructure that binds strings to simple types. Custom model binders are the correct solution if you want to bind to simple types, but if you want to bind to a complex type, the recommendation is to implement a TypeConverter according to the offical docs. But the docs don't provide an example that shows how to do that in the context of model binding. So here's one.

收录时间: 2020-11-26
分类: ASP.NET Core
贡献者: Rector
AD 友情赞助
39 热度

Applying the MVC design pattern to Razor Pages

In this article we look in greater depth at how the MVC design pattern applies to Razor Pages in ASP.NET Core. This will also help clarify the role of various features of Razor Pages.

收录时间: 2020-11-25
分类: ASP.NET Core
贡献者: Rector
39 热度

C# 9 Records as DDD Value Objects

Today, we’ll talk about the new C# 9 feature, Records, and whether or not they can be used as DDD value objects. C# 9’s Records is a nice feature where the compiler automatically generates a whole bunch of useful boilerplate code for you. For example, for a record like this...

收录时间: 2020-11-25
分类: C#开发
贡献者: Rector
38 热度

Spectre.Console lets you make beautiful console apps with .NET Core

I've long said, as a fan of the console and text mode, that the command line is underloved. You can do accelerated 3D VR, sure, but impress me with a nice ASCII progress bar or spinner and oh my! *Chef's kiss*. Enter yet another lovely Console library in the form of Spectre.Console. You may know Patrik Svensson as the creator of the wonderful Cake build system. He is also enhancing our consoles with Spectre.Console. It even has support for Figlet! What's FIGlet you say?!? Well, it's giant fonts with ASCII, of course!

收录时间: 2020-11-25
分类: .NET Core
贡献者: Rector
31 热度

Roland Weigelt - Tiny Difference, Big Consequences Reloaded: SignalR in .NET Core 3.1 vs. .NET 5

In a past blog post I wrote about a surprising change I encountered during the migration of a .NET Core 2.2 application to .NET Core 3.0. I have just migrated that same application to .NET 5 and guess what, I stumbled across another “tiny difference with big consequences”. The situation: I have a WPF desktop client that communicates with an ASP.NET Core server that in turn communicates with a small TypeScript browser application. I use Web API for accessing files and meta data, and SignalR to call remote functions.

收录时间: 2020-11-25
分类: ASP.NET Core
贡献者: Rector
29 热度

Improving your ASP.NET Core site's e-mailing capabilities

Many websites depend heavily on e-mail: they send account confirmation e-mails, password reset e-mails, order confirmations, back-in-stock notifications and much more. Despite its importance, I often see that sending e-mail is an overlooked area when writing well maintainable and stable code. It's also often overlooked when monitoring sites and lots of code I have seen just assumes the mail server is up and running. But problems will occur; mail servers will go down, passwords do expire or get changed without updating the web site and more.

收录时间: 2020-11-25
分类: ASP.NET Core
贡献者: Rector
AD 友情赞助