33 热度

Using SignalR in ASP.NET Core & React to Send Messages

We did a live stream where we integrated SignalR with ASP.NET Core and React. We went ahead and built a system where you can send messages in a React app. From there, it used SignalR to send the message to the ASP.NET Core app. Once the ASP.NET Core app got the message, it sent it’s own message back to the React app. We are going to recap on the steps we went through in that demo to successfully integrate SignalR with React and ASP.NET Core.

收录时间: 2020-07-03
分类: ASP.NET Core
贡献者: Rector
40 热度

Visualizing ASP.NET Core endpoints using GraphvizOnline and the DOT language

In this post I show how the endpoint routes in an ASP.NET Core 3.0 application can be visualized using the GraphvizOnline service. That lets you create diagrams like the following, which describe all the endpoints in your application...

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

Creating a Multi-Tenant ASP.NET Core Web API with Dapper and SQL RLS

In this post, we are going to create a multi-tenant ASP.NET Core web API by leveraging Dapper and SQL Server Row Level Security (RLS).

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

客官,来看看AspNetCore的身份验证吧

对于大多数应用系统来说,几乎都离不开身份验证。因为我们需要保护一些数据,不让“非法”用户获取。所以我们必须得根据自身项目情况来添加对身份验证的支持功能。在这之前,我们先不要考虑什么Bearer,JWT,OpenId等概念,忘掉他们,让我们从0开始。假如我们现在有一个Web Api应用程序,采用了AspNetCore来编写。在没有任何标准协议和框架的支持下,我们会如何对一个用户进行身份验证呢?

收录时间: 2020-06-30
分类: ASP.NET Core
贡献者: Rector
37 热度

从零开始实现ASP.NET Core MVC的插件式开发(八) - Razor视图相关问题及解决方案

在上一篇中,我给大家分享了程序调试问题的解决方案以及如何实现插件中的消息传递,完稿之后,又收到了不少问题反馈,其中最严重的问题应该就是运行时编译Razor视图失败的问题。本篇我就给大家分享一下我针对此问题的解决方案,最后还会补上上一篇中鸽掉的动态加载菜单(T.T)。

收录时间: 2020-06-30
分类: ASP.NET Core
贡献者: Rector
36 热度

深入探究ASP.NET Core异常处理中间件

全局异常处理是我们编程过程中不可或缺的重要环节。有了全局异常处理机制给我们带来了很多便捷,首先我们不用满屏幕处理程序可能出现的异常,其次我们可以对异常进行统一的处理,比如收集异常信息或者返回统一的格式等等。ASP.NET Core为我们提供了两种机制去处理全局异常,一是基于中间件的方式,二是基于Filter过滤器的方式。Filter过滤器的方式相对来说比较简单,就是捕获Action执行过程中出现的异常,然后调用注册的Filter去执行处理异常信息,在这里就不过多介绍这种方式了,接下来我们主要介绍中间件的方式。异常处理中间件ASP.NET Core为我们提供了几种不同处理异常方式的中间件分别...

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

Zero-Downtime* Web Apps for ASP .NET Core 3.1

This is the twenty-sixth of a new series of posts on ASP .NET Core 3.1 for 2020. In this series, we’ve covered 26 topics over a span of 26 weeks from January through June 2020, titled ASP .NET Core A-Z! To differentiate from the 2019 series, the 2020 series mostly focused on a growing single codebase (NetLearner!) instead of new unrelated code snippets week.

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

Nano services with ASP.NET Core or how to build a light API

This post might seem bizzare at first. In fact the idea of writing this article did not come to me on my own. The original idea came from a James Newton King tweet, this last is offering a way to write an API in the simplest possible way, efficient and without any particular framework. I found it cool and that’s why I’m making it a post today. Here is his original tweet: https://twitter.com/JamesNK/status/1276450146365001728

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

Exposing a custom type as a JSON string in an ASP.NET Core API

Sometimes your API needs to expose a non-primitive type that has a “natural” string representation. For instance, a standard representation for a duration is the ISO 8601 format, where “1 month, 2 days, 3 hours and 4 minutes” can be represented as P1M2DT3H4M (note that this isn’t the same as a Timespan, which has no notion of calendar months and years). A duration could be represented in C# as a custom type, like the Duration structure in my Iso8601DurationHelper project. I’ll use this as an example for the rest of this post.

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

JSON-RPC in ASP.NET Core With StreamJsonRpc

I've been pointed to StreamJsonRpc library through a comment under one of my posts and I've decided it's something worth taking a look at. StreamJsonRpc is a .NET Standard implementation of JSON-RPC 2.0 wire protocol.

收录时间: 2020-06-26
分类: ASP.NET Core
贡献者: Rector
71 热度

ASP.NET Core updates in .NET 5 Preview 6

.NET 5 Preview 6 is now availableand is ready for evaluation. Here’s what’s new in this release:Blazor WebAssembly template now includedJSON extension methods for HttpRequest and HttpResponseExtension method to allow anonymous access to an endpointCustom handling of authorization failuresSignalR Hub...

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

YAML-defined CI/CD for ASP .NET Core 3.1

This is the twenty-fifth of a new series of posts on ASP .NET Core 3.1 for 2020. In this series, we’ll cover 26 topics over a span of 26 weeks from January through June 2020, titled ASP .NET Core A-Z! To differentiate from the 2019 series, the 2020 series will mostly focus on a growing single codebase (NetLearner!) instead of new unrelated code snippets week.

收录时间: 2020-06-26
分类: ASP.NET Core
贡献者: Rector
42 热度

Getting started with ASP.NET Core

The Manning Early Access Program (MEAP) has started for the second edition of my book ASP.NET Core in Action, Second Edition. This post gives you a sample of what you can find in the book. If you like what you see, please take a look - for now you can even get a 40% discount with the code bllock2. On top of that, you'll also get a copy of the first edition, free!

收录时间: 2020-06-24
分类: ASP.NET Core
贡献者: Rector
36 热度

Onion Architecture In ASP.NET Core With CQRS - Detailed

In this article, We will talk about Onion Architecture In ASP.NET Core and it’s advantages. We will also together build a WebApi that follows a variant of Onion Architecture so that we get to see why it is important to implement such an architecture in your upcoming projects. You can find the source code of this implementation on my GitHub.

收录时间: 2020-06-24
分类: ASP.NET Core
贡献者: Rector
30 热度

A Guide To Migrating From ASP.NET MVC to Razor Pages

In this post, we’ll explore an existing ASP.NET MVC application, begin to migrate it to Razor Pages, and see where Razor Pages may not be a good fit.

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

完美解决asp.net core 3.1 两个AuthenticationScheme(cookie,jwt)共存在一个项目中

在我的项目中有mvc controller(view 和 razor Page)同时也有webapi,那么就需要网站同时支持2种认证方式,web页面的需要传统的cookie认证,webapi则需要使用jwt认证方式,两种默认情况下不能共存,一旦开启了jwt认证,cookie的登录界面都无法使用,原因是jwt是验证http head "Authorization" 这属性.所以连login页面都无法打开.

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

XML + JSON Output for Web APIs in ASP .NET Core 3.1

This is the twenty-fourth of a new series of posts on ASP .NET Core 3.1 for 2020. In this series, we’ll cover 26 topics over a span of 26 weeks from January through June 2020, titled ASP .NET Core A-Z! To differentiate from the 2019 series, the 2020 series will mostly focus on a growing single codebase (NetLearner!) instead of new unrelated code snippets week.

收录时间: 2020-06-23
分类: ASP.NET Core
贡献者: Rector
24 热度

Display Images in Bootstrap Carousel using Razor Pages and Entity Framework

This short article shows how to display images stored in a database in a Razor Pages application using the Bootstrap Carousel and Entity Framework Core.

收录时间: 2020-06-23
分类: ASP.NET Core
贡献者: Rector
47 热度

ASP.NET Core 对Controller进行单元测试

单元测试对我们的代码质量非常重要。很多同学都会对业务逻辑或者工具方法写测试用例,但是往往忽略了对Controller层写单元测试。我所在的公司没见过一个对Controller写过测试的。今天来演示下如果对Controller进行单元测试。以下内容默认您对单元测试有所了解,比如如何mock一个接口。在这里多叨叨一句,面向接口的好处,除了能够快速的替换实现类(其实大部分接口不会有多个实现),最大的好处就是可以进行mock,可以进行单元测试。

收录时间: 2020-06-18
分类: ASP.NET Core
贡献者: Rector
36 热度

Development With A Dot - ASP.NET Core OData Part 3

This will be the third post on OData and ASP.NET Core 3. Please find the first post (basics) here and the second post (querying) here. This time, I will talk about actions and functions. For demo purposes, let’s consider this domain model...

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