Event sourcing gives you a write Model that is perfectly suited for recording what happened. But reading from an event store is painful for anything beyond a single aggregate. If you want to answer “show me all orders for this customer sorted by date with their current statusâ€, replaying events for every order to reconstruct state is not the answer. CQRS (Command Query Responsibility Segregation) solves this by separating the write model (event store) from the read model (projections).
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by using Microsoft.Extensions.Hosting
🔒 Building AI-Ready Applications with Model Context Protocol in C#
🔧 Building AI-Ready Applications with Model Context Protocol in C# AI-powered applications are no longer just about calling a model and getting a response. Real-world AI systems need context: access to databases, APIs, internal tools, and business logic. The challenge is doing this in a way that is standardised, reusable, and model-agnostic. This is where Model Context Protocol (MCP) comes in.
Azure Function Apps | OkObjectResult Returns Empty JSON After Moving to .NET 9 Isolated Worker Runtime
The Problem I recently upgraded an Azure Function from .NET 8 to .NET 9, and at the same time migrated from the in-process worker to the isolated worker model. After the upgrade, my function that returned OkObjectResult started returning an empty JSON object {} instead of the expected data.
Integrating C# Model Context Protocol servers with Amazon Q Developer CLI | Amazon Web Services
This post shows how to create your own Model Context Protocol (MCP) server with C# and .NET. You will use Amazon Q Developer Command-Line Interface (Amazon Q CLI) as an MCP client. The Model Context Protocol (MCP) is an open standard that lets Artificial Intelligence (AI) models safely interact with external tools and resources.
C# 技术使用笔记:ASP.NET Core 实战开发教程:基于 Dapper ORM 和 Layui 的 Book 管理系统
ASP.NET Core 作为微软推出的一个高性能、跨平台的开源 Web 开发框架,凭借其强大的功能和灵活的扩展性,受到了广大开发者的青睐。它不仅支持多种编程语言,还提供了丰富的中间件和工具,帮助开发者快速构建高效、可靠的 Web 应用。 在实际开发中,数据库操作是 Web 应用的核心功能之一。Dapper 是一个轻量级的 ORM(对象关系映射)工具,它能够高效地将数据库表与 C# 对象进行映射,同时保持代码的简洁性和高性能。Dapper 的使用可以大大简化数据库操作的复杂性,提高开发效率,尤其适合于需要高性能和灵活操作的场景。 前端页面的用户体验同样至关重要。Layui 是一个基于 HTML5 的前端 UI 框架,它提供了丰富的 UI 组件和简洁的样式,能够快速搭建出美观、易用的前端页面。通过 Layui 的表格组件,可以方便地实现数据的展示、分页、排序等功能,提升用户的交互体验。 本教程将结合 ASP.NET Core 8 MVC、Dapper ORM 和 Layui 框架,通过一个完整的实战项目——Book 管理系统,详细讲解如何实现 SQL Server...
Building a Sports-Themed MCP Server Using .NET
I've lived in Melbourne for almost two years now, and throughout that time I've been trying to get my head around Australian rules, or AFL. I live pretty close to where Carlton Football Club train, so I've decided to support them (or as the Australians say "Go for them" 🤷).
Introduction Visual Studio Code (VS Code) is a lightweight yet powerful code editor that supports C# development with ease. Whether you're building a simple console application or a basic web app, correctly setting up your development environment is essential. This guide will walk you through setting up VS Code to create a simple C# console app and a minimal web app (a number guessing game) using ASP.NET Core.
Building C# Web and Console Applications: A Hands-On Guide with a Guessing Game
Introduction C# is a versatile programming language widely used for developing various types of applications, including web and console applications. The .NET framework and .NET Core provide robust environments for building scalable, high-performance applications. This guide outlines the steps for creating a C# web application using ASP.NET Core and a C# console application using .NET. As part of this tutorial, we will build a simple Guessing Game for both console and web environments.
Dependency Injection In .NET Core With Strategy Pattern
In the previous post, we gave an introduction and explained the basic concept of the Strategy Pattern. Now, we want to go a bit further and demonstrate how it works in practice alongside a dependency injection in .NET Core. Instead of manually instantiating strategies, we let the .NET Core DI container inject the correct implementation at runtime.
đźŹ-️ Aplicando Adapter e Decorator Patterns com Injeção de DependĂŞncia no C#
Ao desenvolver software, muitas vezes precisamos integrar sistemas legados e adicionar funcionalidades sem modificar diretamente o código existente. Para isso, podemos usar padrões de design como Adapter e Decorator, que nos ajudam a estruturar o código de forma modular e reutilizável. Neste artigo, vamos explorar como usar esses padrões no C# com injeção de dependência (DI) e a biblioteca Scrutor para simplificar o registro dos decorators.
Adapter Pattern em C# com Injeção de Dependência e Worker Service
🚀 Aplicando o Adapter Pattern em C# com Injeção de Dependência e Worker Service 📌 Introdução Ao trabalhar com sistemas legados, é comum encontrar APIs ou serviços que não seguem as interfaces modernas do nosso código. Em vez de modificar diretamente esses sistemas, podemos usar o Adapter Pattern para fazer a integração de forma elegante. Neste artigo, vou mostrar como implementar o Adapter Pattern em C#, usando Injeção de Dependência (DI) e um Worker Service para simular um processo contínuo.
Boost Your Productivity: New Tools and APIs for Task Automation in .NET 9
In today's fast-paced development environment, automating repetitive tasks is essential for enhancing productivity and maintaining efficiency. .NET 9 introduces a range of new tools and APIs that empower developers to streamline their workflows, reduce manual intervention, and focus on building robust applications. In this blog post, we'll explore the latest advancements in .NET 9 that facilitate task automation, complete with practical C# examples to help you get started.
Dependency Injection Container and Service Lifetimes
• Dependency Injection Container nima? Dependency Injection Container - qisqacha DI Container Dependency Injectionni amalga oshiruvchi mexanizm bo'lib, uning vazifasi dasturdagi servicelarni ro'yxatga olish, servicelarga kerakli bo'lgan boshqa service obyektlarini servicening konstruktoriga tashqaridan Inject qilib berishdir. • Eslatma! Host yaratish va Dependency Injectiondan foydalanish uchun Microsoftning High level darajadagi kutubxonalari.
Dependency Container and Services Lifetimes (На русском)
Этот краткий блог про Dependency Container и Services Lifetimes в котором я объясню: Что такое Dependency Container. Что такое Services Lifetimes. Что такое Hosted Service. Приятного чтения Dependency Container Dependency Container - это инструмент который управляет жизненным компонента. DI Контейнер отвечает за создание и удаление экземпляров необходимых служб, отслеживая их и поддерживая в течение всего срока службы.
Building a Real-Time Stock Price Tracker with .NET 8 GraphQL and React: Market Pulse
Download source code - 68.4 KB Introduction In the ever-evolving landscape of software development, creating applications that provide real-time data and seamless user experiences has become increasingly essential. In this article, we will explore how to build a robust and dynamic stock price tracking application called Market Pulse using .NET 8 with GraphQL for the backend and React for the frontend.
NET 8 and Microservices: New Tools and Techniques to Integrate
Hey team! ๐ If you've been in the development world for a while, you've likely seen the increasing adoption of microservices architectures. They offer flexibility, scalability, and a more efficient way to build complex applications. Now, with NET 8 on the scene, there are some new tools and techniques that make working with microservices even better. Let's dive into what's new and how you can take advantage of these updates in your next project! 1.
How to Create Custom Middleware in Azure Functions: A Step-by-Step Guide with .NET 8
This blog post will walk us through creating custom middleware in Azure Functions using .NET 8. We’ll build a custom exception handler middleware that catches unhandled exceptions, logs them, and returns a standardized error response. By the end of this guide, you'll clearly understand how to create and use middleware in your Azure Functions projects. Azure Functions has become a go-to solution for building serverless applications.
Middlewares in .NET
In modern web application development, efficiently managing HTTP requests is crucial for performance, security, and maintenance. In .NET, middlewares are essential for configuring the request processing pipeline, allowing developers to handle requests and responses in a modular and extendable way. This article explores what middlewares are, how to implement them in .NET, and best practices for their effective use. What is a Middleware? Think of your web application like a restaurant kitchen.
Understanding Background Services in .NET 8: IHostedService and BackgroundService
.NET 8 introduces powerful features for managing background tasks with IHostedService and BackgroundService. These services enable long-running operations, such as scheduled tasks, background processing, and periodic maintenance tasks, to be seamlessly integrated into your applications. This article explores these new features and provides practical examples to help you get started. You can find the source code for these examples on my GitHub repository. What are Background Services?
Teaching Case Report: Automated Testing for Backend APIs wit
Things used in this project This it is part of assignment submitted to Deakin University, School of IT, Unit SIT331 - Full Stack Development Secure Backend Services. By s222575621. Introduction Backend development requires rigorous testing to ensure the robustness, functionality, and performance of APIs. Automated testing using tools like Postman is essential to streamline the testing process and catch defects early.
SIT331 Basic Authentication and Authorization teaching case
Things used in this project This it is part of assignment submitted to Deakin University, School of IT, Unit SIT331 - Full Stack Development Secure Backend Services. By s222575621. Objective The objective of this teaching case is to provide learners with the knowledge and skills to implement a basic authentication and authorization layer in an ASP.NET Core Web API application.
Understanding API Versioning: A Simple Guide -Part 1 : Implementation using C#
Muhammad Taimur I'm Muhammad Taimur, I'm a Software Developer. Currently working in Dublin. I am more into backend side and Cloud Technology. Experienced in APIs Development and Microservices Architecture Location Dublin, Ireland Joined
A Detailed Tutorial on Pagination for ASP.NET Core Web APIs 🚀
Pagination and Filtering implementation in an API is a common practice to optimize responses and efficiently handle large datasets. Here’s a step-by-step guide on how to achieve this in an ASP.NET Core Web API from beginners to intermediate developers. Setting Up Your ASP.NET Core Web API Project First things first, we need to create our project. You can do this using Visual Studio or the command line interface.
How To Use IServiceCollection In Console Applications - What You Need To Know
When it comes to dependency injection and using the built-in IServiceCollection, the framing feels such that we’re restricted to ASP.NET Core. So if we wanted to use IServiceCollection in console applications instead, what options do we have?
【C#】.net core 6.0 在program时间格式统一json格式化,并列举program默认写法和简化写法
欢迎来到《小5讲堂》 这是《C#》系列文章,每篇文章将以博主理解的角度展开讲解。 温馨提示:博主能力有限,理解水平有限,若有不对之处望指正! 背景 在.NET Core 6.0中,对JSON的序列化和反序列化进行了许多改进,特别是与 System.Text.Json命名空间相关的功能。当涉及到在 Program.cs(或 Program.Main方法)中统一时间格式的JSON格式化时,开发者可以配置 JsonSerializerOptions来确保所有序列化的日期和时间都遵循相同的格式。 Main入口 在.NET Core 6.0中,你可以使用System.Text.Json命名空间来控制全局的JSON序列化设置,包括日期时间的格式化。你可以在Program.cs中设置全局的JsonSerializerOptions,以确保整个应用程序中的JSON序列化都按照统一的格式进行处理。 下面是一个示例,在Program.cs中设置全局的JSON序列化选项,包括自定义日期时间格式化: using System; using System.Text.Json; using...
abp9 .net8 升级错误记录
Cannot find compilation library location for package 'System.Security.Cryptography.Pkcs' 修复方法: 将以下配置设置添加到您的 YX.OAM.Web.Mvc.csproj 文件中。 <GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile> 使用多上下文,升级mysql Nuget包为8.0.1后,有时会导致无法访问另一个数据库的数据出现 Access denied for user 'root'@'10.244.4.1' (using password: NO) 通过查找资料需要更改链接字符串为 "Default": "server=localhost;user=root;password=1234;database=ef"; Token获取接口 http://localhost:5000/api/TokenAuth/Authenticate 报错: TIDX10720: Unable to create...
Running Ruby on Rails web apps with .NET Aspire
The Microsoft ecosystem is not kind to Ruby developers. The Ruby SDK for Azure was retired in February 2021, and the support for Ruby in the OpenAPI client generator Kiota is extremely limited, if not unusable. However, .NET Aspire is a special case. This ambitious local development orchestrator is not tied to any specific technology, as I explained in my previous article on the inner workings of .NET Aspire. Therefore, it is possible to run Ruby on Rails web applications on it.
Why I Don't Use AutoMapper in .Net
TL;DR I dislike Automapper as a tool to auto-map objects from one to another. So I performed some benchmark tests around performance and memory usage between AutoMapper and manually mapping an object to a DTO (Data Transfer Object with fewer properties, normally used for API / UI usage). Results found that the manual mapping technique was substantially faster, and more performant than that of AutoMapper.
如何将.NET 8.0的ASP.NET Core Web API部署成Windows服务
写在前面 前面写了一篇关于将.NET应用转换成Windows服务的方法,其实真正的目的是为了探索如何将Asp.Net Core Web Api 部署成Windows 服务。基于上一篇的基础,只需把创建 WebApplication 的代码放到 BackgroundService 的ExecuteAsync方法中即可。 其中比较重要的一个细节就是需要指定一下配置: host.ConfigureAppConfiguration((hostingContext, config) => { config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); config.AddEnvironmentVariables(); }); appsettings.json 的内容如下: { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts":...
通过.NET Core+Vue3 实现SignalR即时通讯功能
.NET Core 和 Vue3 结合使用 SignalR 可以实现强大的实时通讯功能,允许实时双向通信。在这个示例中,我们将详细说明如何创建一个简单的聊天应用程序,演示如何使用 .NET Core SignalR 后端和 Vue3 前端来实现实时通讯功能。 确保你已经安装了以下工具和环境: .NET Core Node.js Vue CLI 首先,让我们创建一个 .NET Core SignalR 后端应用程序。 打开终端并创建一个新的 .NET Core 项目: dotnet new web -n SignalRChatApp cd SignalRChatApp 在项目中添加 SignalR 包: dotnet add package Microsoft.AspNetCore.SignalR 打开 Startup.cs 文件,配置 SignalR 服务: // Startup.cs using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using...
What's new in .NET 8
Article 10/05/2023 .NET 8 is the successor to .NET 7. It will be supported for three years as a long-term support (LTS) release. You can download .NET 8 here. This article has been updated for .NET 8 release candidate (RC) 2. Important This information relates to a pre-release product that may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
【Dotnet 工具箱】推荐一个使用Flutter编写的博客园客户端
简单易用并且同时支持Android/Ios平台。 功能包含博客园首页、新闻列表、博问列表 、闪存、我的博客、知识库等。 截图预览 博客园首页 新闻列表 博问列表 闪存列表 我的 我的资料 我的博客 知识库 博客内容 粉丝关注 在启动项目之前,需要在根目录创建.env文件。里面包含博客园的id和secret。 clientId={{cnblog_client_id}} clientSecret={{cnblog_secret_id}} notRobotCookie=CfDJ8EOBBtWq0dNFoDS-ZHPSe51ATHuFFilG3imii1Hj5WZ-TAK98xT4mJquvSMlYdkzfVCmpAWdt1VyGSpqZ5Q8GulXT3q-Essgs3ttLCLRTzIqo0Klt-nZCkblG6ST2zI2Og 可以在 Github Releases 页面进行下载。 DFrame 是一个适用于 .NET 和 Unity 的分布式压力测试框架。 这个库允许您用纯 C# 代码编写分布式负载测试场景,不需要奇怪的 gui、dsl、xml、json、yaml。除了...
ASP.NET Core - 缓存之分布式缓存
分布式缓存是由多个应用服务器共享的缓存,通常作为访问它的应用服务器的外部服务进行维护。 分布式缓存可以提高 ASP.NET Core 应用的性能和可伸缩性,尤其是当应用由云服务或服务器场托管时。 与其他将缓存数据存储在单个应用服务器上的缓存方案相比,分布式缓存具有多个优势。 当分发缓存数据时,数据: 在多个服务器的请求之间保持一致(一致性)。 在进行服务器重启和应用部署后仍然有效。 不使用本地内存。 .NET Core 框架下对于分布式缓存的使用是基于 IDistributedCache 接口的,通过它进行抽象,统一了分布式缓存的使用方式,它对缓存数据的存取都是基于 byte[] 的。 IDistributedCache 接口提供以下方法来处理分布式缓存实现中的项: Get、GetAsync:如果在缓存中找到,则接受字符串键并以 byte[] 数组的形式检索缓存项。 Set、SetAsync:使用字符串键将项(作为 byte[] 数组)添加到缓存。 Refresh、RefreshAsync:根据键刷新缓存中的项,重置其可调到期超时(如果有)。...
C# Winform中使用 IHttpClientFactory的步骤介绍
C# Winform中使用IHttpClientFactory与HttpClientFactory的步骤介绍六种方法: HttpClientFactory是ASP.NET Core 2.1中引入的一个新特性,它可以帮助我们管理HttpClient实例。在Winform应用程序中,我们也可以使用 IHttpClientFactory来管理HttpClient实例。 在winform项目中添加以下NuGet包: Microsoft.Extensions.Http Microsoft.Extensions.DependencyInjection 上面安装Microsoft.Extensions.Http的NuGet包会连Microsoft.Extensions.DependencyInjectionNuGet包一起安装。 微软使用 .NET 的 IHttpClientFactory介绍https://learn.microsoft.com/zh-cn/dotnet/core/extensions/httpclient-factory...
Guide for running C# Azure Functions in an isolated worker process
Read in English Read in English Edit Twitter LinkedIn Facebook Email Article 05/23/2023 In this article This article is an introduction to working with .NET Functions isolated worker process, which runs your functions in an isolated worker process in Azure. This allows you to run your .NET class library functions on a version of .NET that is different from the version used by the Functions host process. For information about specific .NET versions supported, see supported version.
Net6/SuperSocket2.0课程1,一个Telnet示例_wx6100f2eaee3e8的技术博客_51CTO博客
陈大六 2023-05-21 01:01:34 ©著作权 文章标签 客户端 Server 服务器 文章分类 Html/CSS 前端开发 ©著作权归作者所有:来自51CTO博客作者陈大六的原创作品,请联系作者获取转载授权,否则将追究法律责任 十年河东,十年河西,莫欺少年穷 学无止境,精益求精 1、新建控制台程序并引入包 dotnet add package SuperSocket.Server 2、书写代码 using System; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using SuperSocket; using SuperSocket.ProtoBase; namespace MySupersocket // Note: actual namespace depends on the project name.
ASP.NET Core - 缓存之分布式缓存
分布式缓存是由多个应用服务器共享的缓存,通常作为访问它的应用服务器的外部服务进行维护。 分布式缓存可以提高 ASP.NET Core 应用的性能和可伸缩性,尤其是当应用由云服务或服务器场托管时。 与其他将缓存数据存储在单个应用服务器上的缓存方案相比,分布式缓存具有多个优势。 当分发缓存数据时,数据: 在多个服务器的请求之间保持一致(一致性)。 在进行服务器重启和应用部署后仍然有效。 不使用本地内存。 .NET Core 框架下对于分布式缓存的使用是基于 IDistributedCache 接口的,通过它进行抽象,统一了分布式缓存的使用方式,它对缓存数据的存取都是基于 byte[] 的。 IDistributedCache 接口提供以下方法来处理分布式缓存实现中的项: Get、GetAsync:如果在缓存中找到,则接受字符串键并以 byte[] 数组的形式检索缓存项。 Set、SetAsync:使用字符串键将项(作为 byte[] 数组)添加到缓存。 Refresh、RefreshAsync:根据键刷新缓存中的项,重置其可调到期超时(如果有)。...
mysql 批量插入BulkCopy
一、新建项目:SqlSugarDemo <ItemGroup> <PackageReference Include="SqlSugarCore" Version="5.1.3.52" /> </ItemGroup> 二、连接串未添加AllowLoadLocalInfile=true 中文提示 : BulkCopy MySql连接字符串需要添加 AllowLoadLocalInfile=true; 添加后如果还不行Mysql数据库执行一下 SET GLOBAL local_infile=1 English Message : connection string add : AllowLoadLocalInfile=true show global variables like 'local_infile'; SET GLOBAL local_infile=1 三、Startup.cs using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using...
ASP.NET Core - 缓存之内存缓存(上)
缓存指的是在软件应用运行过程中,将一些数据生成副本直接进行存取,而不是从原始源(数据库,业务逻辑计算等)读取数据,减少生成内容所需的工作,从而显著提高应用的性能和可伸缩性,使用好缓存技术,有利于提高我们提升用户体验性。 对于缓存的使用有以下一些注意点: 缓存最适用于不常更改且生成成本很高的数据。 代码应始终具有回退选项,以提取数据,而不依赖于可用的缓存值。 我们应该以从不依赖于缓存数据的方式编写和测试应用。缓存是会失效的,我们在进行应用开发时应该考虑到缓存失效的情况,提供缓存失效时按照正常逻辑获取相关数据的方式。 缓存使用短缺资源:内存。 我们应该限制缓存增长: 不要将外部输入插入到缓存中。 例如,不建议使用用户提供的任意输入作为缓存键,因为输入可能会消耗不可预测的内存量。 使用过期限制缓存增长。 应当限制缓存的大小,避免缓存过度增长 软件开发中对缓存的使用一般有两种情况,一种是内存缓存,一种是分布式缓存。...
ASP.NET Core - 配置系统之自定义配置提供程序
在 .NET Core 配置系统中封装一个配置提供程序关键在于提供相应的 IconfigurationSource 实现和 IConfigurationProvider 接口实现,这两个接口在上一章 ASP.NET Core - 配置系统之配置提供程序 中也有提到了。 IConfigurationSource IConfigurationSource负责创建IConfigurationProvider实现的实例。它的定义很简单,就一个Build方法,返回IConfigurationProvider实例: public interface IConfigurationSource { IConfigurationProvider Build(IConfigurationBuilder builder); } IConfigurationProvider IConfigurationProvider 负责实现配置的设置、读取、重载等功能,并以键值对形式提供配置。 public interface IConfigurationProvider { //...
ABP微服务系列学习-对接Apollo配置中心 - 饭勺oO - 博客园
前面我们把服务都已经成功启动,并且对接前端Angular界面。 但是在微服务结构中,多个服务意味着需要配置多个配置文件,这时就需要引入配置中心这玩意了。 配置中心有很多现成的方案,比如携程的阿波罗,K8S自带的ConfigMap等等。 这里介绍一下如何对接携程的阿波罗配置中心。 部署Apollo服务 在开发环境,我们可以使用Docker一键搭建我们Apollo服务。 安装部署过程直接看官方文档 这里就不赘述了。 使用docker-compsoe up启动服务后看到日志说明启动成功。 apollo-quick-start | Started [66] apollo-quick-start | Waiting for config service startup... apollo-quick-start | Config service started. You may visit http://localhost:8080 for service status now! apollo-quick-start | Waiting for admin service startup.
Migrate from ASP.NET Core 5.0 to 6.0
Read in English Read in English Edit Twitter LinkedIn Facebook Email Article 01/09/2023 16 minutes to read In this article This article explains how to update an existing ASP.NET Core 5.0 project to ASP.NET Core 6.0. For instructions on how to migrate from ASP.NET Core 3.1 to ASP.NET Core 6.0, see Migrate from ASP.NET Core 3.1 to 6.0. Prerequisites If you rely upon a global.json file to target a specific .NET SDK version, update the version property to the .NET 6.0 SDK version that's installed.
ASP.NET Core -配置系统
一个应用要运行起来,往往需要读取很多的预设好的配置信息,根据约定好的信息或方式执行一定的行为。 配置的本质就是软件运行的参数,在一个软件实现中需要的参数非常多,如果我们以 Hard Code (硬编码)的方式写在应用代码中,这样配置就会很乱,而且后续也不容易修改。乱而多,而且不容易修改,这就需要一个统一管理的地方,最常见的方式就是配置文件,这个也是开发人员非常熟悉的方式。 通过配置文件设置好软件应用运行的各种参数之后,我们在开发过程中需要能够读取到配置文件的内容,根据配置内容进行软件逻辑的判断,实现完善的软件行为逻辑。这一篇就是介绍 .NET Core 框架下怎么使用配置系统,这也是 .NET Core 下的基础设施之一。 配置读取是配置系统最基本的操作,几乎是每个开发人员都会进行的操作,一个开发人员可能不清楚配置系统是怎么实现的,配置文件是怎么解析的,但一定都做过读取配置信息的操作。.NET Core 框架下对于配置系统的使用最终暴露出来的接口是 IConfiguration,它是供配置数据的统一视图,配置读取就通过这个接口的实现来进行。 默认创建的 ASP .NET Core...
Application Insights
Não se pode gerenciar o que não se pode medir A ideia é compartilhar algumas situações que já passei para instrumentar uma aplicação utilizando o recurso Application Insights, é verdade que está cada vez mais fácil de se fazer isso, principalmente nas últimas versões do .NET Core, no entanto existem cenários onde um pouco de ajuda pode poupar dias de tentativas e erros. O que é o Application Insights?
如何将.NET Core部署为Windows服务
这篇文章主要介绍了.NET Core部署为Windows服务,想要将.NET Core部署为window服务,项目中需要进行以下配置:项目中引入Microsoft.Extensions.Hosting.WindowsServices包,本文给大家详细讲解,需要的朋友可以参考下 一、概述 目前测试了下面两个项目,均可以部署为Windows服务运行。部署的方式 二、.NET Core部署Windows服务 1、项目中需要的配置 想要将.NET Core部署为window服务,项目中需要进行以下配置:项目中引入Microsoft.Extensions.Hosting.WindowsServices包 修改Program.cs文件,添加UseWindowsService()方法调用 using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using System.Net; namespace XXService { public class Program { public static void...
ASP.NET Core 3.1系列(13)--本地缓存MemoryCache的使用
1、前言 在实际开发过程中,缓存(Cache)是一项重要技术。有时候为了缓解数据库访问的压力,我们可以将一些需要经常读取但又几乎不会变化的数据存在缓存里,以此加快数据的访问速度。在ASP.NET Core中,缓存一般分为本地缓存和分布式缓存。相较于分布式缓存(Redis),本地缓存并不会将数据写入磁盘中,它只是将数据存储在内存中进行操作,因此本地缓存的数据会随着应用程序的重启而丢失。一般情况下,如果需要存储的数据不多,同时也没有数据持久化的要求,则可以考虑使用本地缓存。下面开始介绍其使用方法。 2、本地缓存的读写操作 2.1、添加本地缓存服务 打开Startup.cs文件,添加本地缓存的相关服务,代码如下所示: using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using...
C# Worker Service的基础应用
Worker Service是微软提供的一个项目模板,它继承于BackgroundService。在使用.NET Framework时,我们可以使用Windows Service来创建Windows服务,而在使用.NET Core及更高的.NET版本时,就可以使用Worker Service来取代Windows Service,以便创建跨平台服务。 在微软的.NET文档的运行时库(Runtime libraries)分支中,辅助角色服务(Worker Services)详细介绍了Worker Service的使用。 以下为微软文档的链接: .NET 中的辅助角色服务 | Microsoft Docs 本文代码已上传至GitHub,项目链接如下: https://github.com/XMNHCAS/WorkerServiceDemo 打开Visual Studio,创建一个新的Worker Service项目,如下图所示: 创建完成后,直接运行,会出现一个控制台窗口,并打印出运行信息: 项目创建成功后,Windows会预设一个Worker...
ASP.NET Core 3.1系列(4)--读写配置文件appsettings.json
1、前言 在大多数的应用程序中,一些参数需要写在配置文件里,以此增加系统的灵活性。在ASP.NET时代,配置参数一般会写在web.config文件中,其本质上是对XML文件的读取和写入。而在ASP.NET Core中,配置文件变成了appsettings.json文件。相较于XML,JSON文件更加轻量且灵活,下面就来介绍一下如何在ASP.NET Core中对其进行读写操作。 2、添加配置参数 打开appsettings.json文件,添加如下配置项。如果对JSON文件的格式不熟悉,建议先了解一下其格式规范,其代码如下所示: { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*", "ConnectionStrings": { "ConnectionString": "Data Source=DSF-PC;Initial...
Building Serverless Web App Blazor Chart-Azure Functions API
In this third article, we’ll work through the steps needed to create an Azure Functions backend that serves up our dataset via an HTTP API. Introduction Welcome to this third article in a series demonstrating how to create a Blazor client application that incorporates a Telerik UI For Blazor Chart component. If you haven’t already read the second article, that should be your starting point.
ASP.NET Core 6 to Challenge Python and Node
When comparing .NET to Python or Node, one of the complaints is the amount of ceremony around setting up a new project. Even the simplest web service is expected to have a Program class, a Startup class, and one or more Controller classes.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with using
Contact using, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack