9 热度

ASP.NET Core Vue CLI Templates

In this article we will discuss several options for integrating ASP.NET Core and the Vue CLI, one of them already available in NuGet, thanks to Software Ateliers. If you have chosen Vue.js and ASP.NET Core as your web stack, I hope this article will help you understand how both fit together, and at the same time, help you get started.

收录时间: 2019-06-27
分类: ASP.NET Core
贡献者: Rector
8 热度

Creating a Custom Tag Helper in ASP.NET Core: Generating HTML

This post is about the exciting part of creating a custom tag helper: generating new HTML to go down to the user in the place of whatever "placeholder" tag you insert into your View or Razor Page.A quick review of where we are now: In a previous postI talked about the structure of a tag helper (Razo...

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

Dynamically generating robots.txt for ASP.NET Core sites based on environment

I'm putting part of older WebForms portions of my site that still run on bare metal to ASP.NET Core and Azure App Services, and while I'm doing that I realized that I want to make sure my staging sites don't get indexed by Google/Bing. I already have a robots.txt, but I want one that's specific to p...

收录时间: 2019-06-21
分类: ASP.NET Core
贡献者: Rector
109 热度

ASP.NET Core依赖注入——依赖注入最佳实践

在这篇文章中,我们将深入研究.NET Core和ASP.NET Core MVC中的依赖注入,将介绍几乎所有可能的选项,依赖注入是ASP.Net Core的核心,我将分享在ASP.Net Core应用中使用依赖注入的一些经验和建议,并且将会讨论这些原则背后的动机是什么:(1)有效地设计服务及其依赖关系。(2)防止多线程问题。(3)防止内存泄漏。(4)防止潜在的错误。在讨论该话题之前,了解什么是服务是生命周期至关重要,当组件通过依赖注入请求另一个组件时,它接收的实例是否对该组件实例是唯一的取决于生命周期。 因此,设置生存期决定了组件实例化...

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

Add ASP.NET Core's Dependency Injection into Xamarin Apps with HostBuilder

Dependency injection(DI) and inversion of control (IoC), have been a recurring theme in questions that I have received over the last six years. Sometimes it is around using constructor injection(), simple service containers, and often around full frameworks such as Prism or MVVM Light. I will be honest with you, I have never been a fan of DI/IoC when building mobile apps.

收录时间: 2019-06-20
分类: ASP.NET Core
贡献者: Rector
25 热度

Multiple Ways to Register Your Dependencies with ASP.NET Core 3

Exploring the multiple ways you can register your service dependencies with the new IHost found in ASP.NET Core 3 (Preview).

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

asp.net core使用中间件美化开发环境异常页面

asp.net core系统自带的异常页面色彩给人感觉模糊、朦胧,晕眩! 原版: 美化版  实现思路:(在系统自带异常中间件“DeveloperExceptionPageMiddleware”执行后,调用自定义的异常中间件“DeveloperExceptionPrettifyMiddleware”,继续向响应流输出美化的css和js)...

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

State Management in ASP.NET Core MVC

HTTP is a stateless protocol. So HTTP requests are independent messages that don’t retain user values or app state. We need to take additional steps to manage state between the requests. In this article, we are going to look at various approaches to the HTTP state management that we can use in our application.

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

使用 MiniProfiler 来分析 ASP.NET Core 应用

MiniProfiler(https://miniprofiler.com/)是一个轻量级且简单易用的分析工具库,它可以用来分析ASP.NET Core应用。 优点针对ASP.NET Core MVC应用,使用MiniProfiler的优点是:它会把结果直接放在页面的左下角,随时可以点击查看;这样的话就可以感知出你的程序运行的怎么样;同时这也意味着,在你开发新功能的同时,可以很快速的得到反馈。 安装配置MiniProfiler在现有的ASP.NET Core MVC项目里...

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

asp.net core使用serilog将日志推送到腾讯云日志服务

为什么是serilog?Serilog是 .NET 中最著名的结构化日志类库。基于日志事件log events,而不是日志消息log message。你可以将日志事件格式化为控制台的可读文本或者可以将相同的事件格式化为JSON并将其发送到远程日志服务器。应用程序中的日志语句会创建LogEvent对象,而连接到管道的接收器[sinks]会知道如何记录它们。这里有一篇文章比较了.NET目前三种最常用的日志组件,有兴趣可以去看看。nlog-vs-log4net-vs-serilog-comparing-net-logging为什么是腾讯云日志服务?最普通的日志记录大概是直接把日志写入本地文件进行记录...

收录时间: 2019-06-14
分类: ASP.NET Core
贡献者: Rector
52 热度

asp.net core 集成JWT(二)token的强制失效,基于策略模式细化api权限

【前言】上一篇我们介绍了什么是JWT,以及如何在asp.net core api项目中集成JWT权限认证。传送门:https://www.cnblogs.com/7tiny/p/11012035.html很多博友在留言中提出了疑问:如何结合jwt认证对用户进行API授权?token过期了怎么办?如何自动刷新token?如何强制token失效?如何应用到集群模式?那么,便有了本篇。本篇在上一篇的基础上继续完善JWT的使用,并陆续回答上面的疑问。当然Demo中没有体现的也会提供思路供博友参考。【一、如何结合JWT认证对用户进行API授权】场景:我们有多个API接口,我们希望细化地控制哪个用户可以访...

收录时间: 2019-06-14
分类: ASP.NET Core
贡献者: Rector
35 热度

ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 6

.NET Core 3.0 Preview 6 is now availableand it includes a bunch of new updates to ASP.NET Core and Blazor.Here’s the list of what’s new in this preview:New Razor features...

收录时间: 2019-06-13
分类: ASP.NET Core
贡献者: Rector
90 热度

ASP.NET Core 奇淫技巧之动态WebApi

接触到动态WebApi(Dynamic Web API)这个词的已有几年,是从ABP框架里面接触到的,当时便对ABP的这个技术很好奇,后面分析了一波,也尝试过从ABP剥离一个出来作为独立组件来使用,可是后来因与ABP依赖太多而放弃。十几天前朋友 熊猫将这部分代码(我和他在搞事情)成功的从 ABP 中剥离出来并做了一个简单Demo扔给我,经过这么久(实在是太懒^_^)终于经过一些修改、添加功能、封装,现在已经能作为一个独立组件使用,项目开源在Github(https://github.com/dotnetauth/Panda.DynamicWebApi...

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

ASP.Net Core Using the Decorator Pattern

Refactoring to use the Decorator Design Pattern to help apply the Single Responsibility Principle.

收录时间: 2019-06-12
分类: ASP.NET Core
贡献者: Rector
35 热度

Implementing Sign In with Apple in ASP.NET Core

In this article, I’m going to take a brief look at how Sign In with Apple is hooked together, and then show a proof of concept integration using ASP.NET Core.

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

Asp.net core使用MediatR进程内发布/订阅

最近,一个工作了一个月的同事离职了,所做的东西怼了过来。一看代码,惨不忍睹,一个方法六七百行,啥也不说了吧,实在没法儿说。介绍下业务场景吧,一个公共操作A,业务中各个地方都会做A操作,正常人正常思维应该是把A操作提取出来封装,其他地方调用,可这哥们儿偏偏不这么干,代码到处复制。仔细分析了整个业务之后,发现是一个典型的事件/消息驱动型,或者叫发布/订阅型的业务逻辑。鉴于系统是单体的,所以想到利用进程内发布/订阅的解决方案。记得很久之前,做WPF时候,用过Prism的EventAggregator(是不是暴露年龄了。。。),那玩意儿...

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

Clever little C# and ASP.NET Core features that make me happy

I recently needed to refactor my podcast site which is written in ASP.NET Core 2.2 and running in Azure. The Simplecast backed API changed in a few major ways from their v1 to a new redesigned v2, so there was a big backend change and that was a chance to tighten up the whole site.

收录时间: 2019-06-10
分类: ASP.NET Core
贡献者: Rector
52 热度

Building a Live Reload Middleware Component for ASP.NET Core

In this post I'll describe how to build this middleware component that handles the Live Reload functionality natively in ASP.NET Core simply by hooking a couple of middleware directives into your Startup configuration. The end result is much quicker and more reliable refreshes of content than with BrowserSync.

收录时间: 2019-06-05
分类: ASP.NET Core
贡献者: Rector
43 热度

Integrating Blazor into Existing ASP.NET Core Applications

If you want to add server-side Blazor to your existing ASP.NET Core applications, you can. There's not much to it, fortunately. In fact, there's probably more work involved in creating a View or Page that will play well with your component

收录时间: 2019-06-05
分类: ASP.NET Core
贡献者: Rector
45 热度

ASP.NET Core - 基于IHttpContextAccessor实现系统级别身份标识

ASP.NET Core - 基于IHttpContextAccessor实现系统级别身份标识问题引入:我们知道当请求通过认证模块时,会给当前的HttpContext赋予当前用户身份标识,我们在需要授权的控制器中打上[Authorize]授权标签,就可以在ControllerBase的User属性获取到基于声明的权限标识(ClaimsPrincipal)。遗憾的是这只是针对Controller层面,很多场景下我们是需要在Service层乃至数据层获直接使用用户信息,这种情况我们就使用不了User了...

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