28 热度

Monitoring .NET Core applications on Kubernetes

In this article, I show you how to use Prometheus to monitor a .NET Core application running on Kubernetes. Note that installation instructions are not included with the article. I do include a reference for using the Prometheus Operator to create and configure Prometheus on Kubernetes.

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

Using .NET Core Tools to Create Reusable and Shareable Tools & Apps

Starting with .NET Core 2.1 Microsoft introduced the Dotnet Tools platform as part of the .NET Core SDK and since then these tools have become a vital although underutilized part of the .NET Eco system. Dotnet Tools are a simple way to create, publish and consume what are essentially .NET Core applications that can be published and shared using the existing NuGet infrastructure for packaging and distribution. This means it's really quick and easy to build tools that you can share either publicly or privately.

收录时间: 2020-08-06
分类: .NET Core
贡献者: Rector
32 热度

Testing and Configuration in .NET Core

When running automated tests, or running things locally, I often want to use a different configuration to what I would run in production. A JSON file often suffices for local development, however this isn’t useful for automated tests where I want different configurations for different tests, or if my configuration is dynamic (e.g. I need to spin up a docker container during startup, and I have to get some configuration from that on the fly).

收录时间: 2020-08-05
分类: .NET Core
贡献者: Rector
32 热度

.Net Core HttpClient处理响应压缩

在上篇文章[ASP.NET Core中的响应压缩]中我们谈到了在ASP.NET Core服务端处理关于响应压缩的请求,服务端的主要工作就是根据Content-Encoding头信息判断采用哪种方式压缩并返回。之前在群里有人问道过,现在的网络带宽这么高了还有必要在服务端针对请求进行压缩吗?确实,如今分布式和负载均衡技术这么成熟,很多需要处理高并发大数据的场景都可以通过增加服务器节点来进行。但是,在资源受限的情况下,或者是还没必要为了某一个点去增加新的服务器节点的时候,我们还是要采用一些程序本身的常规处理手段来进行处理。笔者个人认为响应压缩的使用场景是这样的,在带宽压力比较紧张的情况,且CPU...

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

Exploring the code behind IHttpClientFactory in depth

In this post I take a look at the code in the default implementation of IHttpClientFactory in ASP.NET Core—DefaultHttpClientFactory. We'll see how it ensures that HttpClient instances created with the factory prevent socket exhaustion, while also ensuring that DNS changes are respected.This post ass...

收录时间: 2020-08-05
分类: .NET Core
贡献者: Rector
29 热度

.NET Core Console Apps - A Better Way?

I was at a customer site last week and a lot of their integration code is a set of console apps that are run on timers to import and export data. This isn't an uncommon use-case. I've got a couple of these lying around myself. I realized that I didn't know of a good exemplar of doing simple console apps using .NET Core in a way that is closer to ASP.NET Core (e.g. dependency injection, lifetime management, cancellation, etc.). So I decided to re-write an old console app I have.

收录时间: 2020-08-04
分类: .NET Core
贡献者: Rector
AD 友情赞助
31 热度

How do I find which directory my .NET Core console application was started in or is running from?

I got a great question emailed to me today. And while I could find the answer and email them back, I also have a limited number of keystrokes. Plus, every question that moves knowledge forward is a gift, and I don't want to ignore a gift. So instead, I've email my new friend a link to this blog!

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

Despite .NET Core 3 Deprecation, Newtonsoft JSON Serializer Still Rules NuGet Roost

Despite being deprecated by Microsoft in .NET Core 3.0, the wildly popular Newtonsoft.Json JSON serializer still rules the roost in the NuGet package manager system for .NET developers.

收录时间: 2020-07-30
分类: .NET Core
贡献者: Rector
58 热度

.NET Core学习笔记(7)——Exception最佳实践

1.为什么不要给每个方法都写try catch为每个方法都编写try catch是错误的做法,理由如下:a.重复嵌套的try catch是无用的,多余的。这一点非常容易理解,下面的示例代码中,OutsideMethodA中的try catch是不起作用的...

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

.NET Core + K8S + Loki 玩转日志聚合

最近在了解日志聚合系统,正好前几天看到一篇文章《用了日志系统新贵Loki,ELK突然不香了!》,所以就决定动手体验一下。本文就带大家快速了解下Loki,并简单介绍.NET Core如何集成Loki。

收录时间: 2020-07-27
分类: .NET Core
贡献者: Rector
53 热度

Heartbeat logger in Dotnet Core

t's important to monitor your applications so that you can act fast when problems occurs. When it comes to web applications it's common to have a /health endpoint that responds back with the status of your application. Usually a response indicates that everything is OK. If no response (timeout) or a 500 Internal Server Error response usually means that you have a problem. When using Kubernetes, Docker or basically any cloud provider you can also choose to spin up new instances of your application if any of your running instances responds with a non OK status.

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

一套基于 React-ANTD、SignalR、.NET CORE 的消息推送解决方案

一套基于 React-ANTD、SignalR、.NET CORE 的消息推送解决方案

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

.net core 自带分布式事务的微服务开源框架JMS

事务的统一性是微服务的一个重点问题,简洁有效的控制事务,更是程序员所需要的。JMS的诞生,就是为了更简单、更有效的控制事务。

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

Travis logs and .NET Core console output

This is a blog post rather than a bug report, partly because I really don’t know what’s at fault. Others with more knowledge of how the console works in .NET Core, or exactly what the Travis log does, might be able to dig deeper.

收录时间: 2020-07-21
分类: .NET Core
贡献者: Rector
69 热度

Thread Safety & Scoped Lifetime in Dependency Injection Containers

If you’re using Scoped Lifetime in a Dependency Injection containers, beware! You may be run into race conditions due to a lack of thread safety. I was doing a live stream on Domain Events over on my YouTube Channel where I was taking advantage of Scoped Lifetime. After the stream, I realized Scoped Lifetime and thread safety isn’t mentioned much and I’m not sure why? It could be because developers aren’t using multiple threads within the top-level request (HTTP request or service bus message invocation). Or it’s because developers are writing thread-safe code by default. I tend to think it’s the former. Either way, I figured it would be worthwhile providing an example of using Scoped Lifetime and how you can run into issues if you aren’t writing thread-safe code.

收录时间: 2020-07-16
分类: .NET Core
贡献者: Rector
AD 友情赞助
69 热度

Modernizing and containerizing a legacy MVC .NET application with Entity Framework to .NET Core with Entity Framework Core: Part 1 | Noise

Tens of thousands of .NET applications are running across the world, many of which are ASP.NET web applications. This number becomes interesting when you consider that the .NET framework, as we know it, will be changing significantly. The current release schedule for .NET 5.0 is November 2020, and going forward there will be just one .NET that you can use to target multiple platforms like Windows and Linux. This is important because those .NET applications running in version 4.8 and lower can’t automatically upgrade to this new version of .NET. This is because .NET 5.0 is based on .NET Core and thus has breaking changes when trying to upgrade from an older version of .NET. This is an important step in the .NET Eco-sphere because it enables .NET applications to move beyond the Windows world. However, this also means that active applications need to go through a refactoring before they can take advantage of this new definition. One choice for this refactoring is to wait until the new version of .NET is released and start the refactoring process at that time. The second choice is to get an early start and start converting your applications to .NET Core v3.1 so that the migration to .NET 5.0 will be smoother. This post demonstrates an approach of migrating an ASP.NET MVC (Model View Controller) web application using Entity Framework 6 to and ASP.NET Core with Entity Framework Core. This post shows steps to modernize a legacy enterprise MVC ASP.NET web application using .NET core along with converting Entity Framework to Entity Framework Core.

收录时间: 2020-07-15
分类: .NET Core
贡献者: Rector
56 热度

.NET Core CLI 的性能诊断工具介绍

开发人员的.NET Core项目上线后,经常会出现各种问题,内存泄漏,CPU 100%,处理时间长等, 这个时候就需要快速并准确的发现问题,并解决问题, 除了项目本身的日志记录外,NET Core 为我们开发人员提供了一系列功能强大并且无侵入的诊断工具,本文主要介绍的是 .NET Core dotnet 诊断全局工具先决条件支持.NET Core 3.0 SDK 及更高版本, .NET Core 命令行接口 (CLI) 工具dotnet-countersdotnet-counters 是一个性能监视工具,用于临时运行状况监视和初级性能调查, 你可以通过命令查看和存储,当前程序的运行时信息,...

收录时间: 2020-07-13
分类: .NET Core
贡献者: Rector
54 热度

PrimeHotel – adding Entity Framework Core 5 in .NET

In this post we will work with the PrimeHotel project, that was created for learning purposes. It’s all available at my GitHub, so you can download it freely. Take a look also at this post on how to run it: PrimeHotel – how to run this project.

收录时间: 2020-07-13
分类: .NET Core
贡献者: Rector
70 热度

.Net Core微服务入门全纪录(八)——Docker Compose与容器网络

上一篇【.Net Core微服务入门全纪录(七)——IdentityServer4-授权认证】中使用IdentityServer4完成了鉴权中心的搭建,配合网关实现了统一的授权认证。进行到这里,系统环境已经比较复杂了,想把整个系统运行起来会非常繁琐:要运行Consul、业务服务、网关、鉴权中心、web客户端,还要安装数据库、MQ等等。。。那么本篇将使用Docker Compose来解决以上问题,仅需一个简单的命令,即可启动整个环境。

收录时间: 2020-07-09
分类: .NET Core
贡献者: Rector
55 热度

Event Sourcing in .NET Core – part 1: A gentle introduction

Event sourcing, aka “the great myth”. I’ve been thinking about writing a series of articles about this for a while, and now it’s time to put my hands back on the keyboard.I thought that with all this bull**it pandemic at least I could have had more time to write on this blog but it turns out the rea...

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