.NET on AWS Blog Introduction Log analysis helps you maintain reliable applications by identifying issues, troubleshooting problems, and gaining operational insights. Traditional log analysis struggles with unstructured data and requires hours of manual work to extract meaningful patterns. Generative AI transforms this process by automatically identifying anomalies, understanding context, and surfacing specific recommendations without complex configuration.
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.Logging
Use Dev Proxy with .NET Azure Functions
Share via Note Access to this page requires authorization. You can try signing in or changing directories. Access to this page requires authorization. You can try changing directories. At a glance Goal: Use Dev Proxy with .NET Azure Functions Time: 10 minutes Plugins: Various Prerequisites: Set up Dev Proxy, Azure Functions Core Tools If you build Azure Functions using .NET and want to use Dev Proxy, follow the general guidance for using Dev Proxy with .NET applications.
🔒 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.
HTML to PDF C# in .NET 10: A Technical Guide for .NET Developers
Even in today’s modern era of technology and AI, we still often find ourselves needing to format. This is a task that remains essential for enterprise applications, from compliance reports and automated invoices to on-demand PDFs from web content. Whether generating PDFs from entire web pages, HTML strings, or templates, the choice of PDF engine affects performance, security, and maintainability.
HTML to PDF C# in .NET 10: A Technical Guide for .NET Developers
Originally Posted On: https://www.c-sharpcorner.com/article/html-to-pdf-c-sharp-in-net-10-a-technical-guide-for-net-developers/ Even in today’s modern era of technology and AI, we still often find ourselves needing to convert HTML to PDF format. This is a task that remains essential for enterprise applications, from compliance reports and automated invoices to on-demand PDFs from web content.
【后端】.NET Core API框架搭建(8) --配置使用RabbitMQ
目录 6.注册 在 .NET Core 应用程序中使用 RabbitMQ 有许多好处,主要体现在其作为消息队列系统所带来的灵活性、可靠性和扩展性等方面,还能促进微服务架构的实施,是构建现代分布式应用的理想选择之一 1.添加包 添加 RabbitMQ.Client 包。 2.
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" 🤷).
Log Framework Integration in Azure Functions with Azure Cosmos DB
Introduction Logging is an essential part of application development, especially in cloud environments where monitoring and debugging are crucial. In Azure Functions, there is no built-in provision to log application-level details into a centralized database, making it challenging to check logs every time in the Azure portal.
Azure Database for Mysql Trigger for Azure Functions in Public Preview
Microsoft has recently introduced a public preview of Azure Database for MySQL trigger for Azure Functions. With these triggers, developers can build solutions that track changes in MySQL tables and automatically trigger Azure Functions when rows are created, updated, or deleted. Azure Functions is Microsoft’s serverless computing offering. It allows developers to build and run event-driven code without managing infrastructure. Within functions, triggers and bindings are defined.
Enhancing Request Pipelines with MediatR Behaviors
Introduction MediatR is a widely used library in .NET applications that follows the mediator pattern, helping to decouple requests from handlers. While it simplifies CQRS (Command Query Responsibility Segregation), it also offers a robust feature called Pipeline Behaviors. These behaviors enable developers to intercept requests and implement cross-cutting concerns such as logging, validation , performance tracking , transaction management , and error handling in a structured and reusable manner.
How to Use FakeLogger to Make Testing Easier In .Net
When writing unit tests in .NET, you may need to verify that methods are logging exceptions, errors, or other key information. You might think, No problem, I'll just mock ILogger using my favourite mocking library – for example Moq, NSubstitute, or FakeItEasy. While ILogger itself is an interface and can be mocked, many of its commonly used logging methods (like LogInformation(), LogError(), and so on) are what’s called static or extension methods.
đźŹ-️ 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.
Develop Microservices Using Azure Functions, API Management
Microservices are a popular architectural pattern for building scalable and modular applications. They allow developers to focus on building small, independent, and reusable services that interact with each other through APIs. This blog will guide you through creating a simple serverless microservice and deploying it to Azure Cloud. I have used this approach to start building simple prototypes of various products, get early feedback from customers, and iterate faster.
Building an Intelligent SQL Query Assistant with Neon, .NET, Azure Functions, and Azure OpenAI service
Neon SQL editor provides AI-driven features, such as SQL generation to easily convert natural language requests to SQL. However, there may be situations where you need to build your own AI query assistant for custom needs. For example, you might need tighter integration with your application via query API, add advanced domain-specific logic, hide business-critical data, or support for complex multi-step queries that built-in tools typically don’t handle.
Building a SQL Query Assistant with Neon, .NET, Azure Functions, OpenAI service
Neon SQL editor provides AI-driven features, such as SQL generation to easily convert natural language requests to SQL. However, there may be situations where you need to build your own AI query assistant for custom needs. For example, you might need tighter integration with your application via query API, add advanced domain-specific logic, hide business-critical data, or support for complex multi-step queries that built-in tools typically don’t handle.
.NET6中使用RabbitMQ详尽指南-CSDN博客
解释: RabbitMQ 是一个流行的开源消息队列系统,广泛用于实现异步通信、解耦组件、负载均衡等场景。在本篇博客中,我们将详细介绍如何在 .NET 6 中使用 RabbitMQ,包括生产者和消费者的实现,以及如何通过依赖注入来管理它们。 一、创建 .NET 6 应用 首先,确保你已经安装了 .NET 6 SDK。可以使用命令行工具创建一个新的 .NET 控制台应用: dotnet new console -n RabbitMQDemo cd RabbitMQDemo 接着,你需要安装 RabbitMQ 的客户端库,通过 NuGet 包管理器来安装 RabbitMQ.Client: dotnet add package RabbitMQ.Client; //这里我们选择 6.4.0 版本 dotnet add package Masuit.Tools.Core; //这个为一个 二、配置 RabbitMQ 接下来,我们需要定义连接 RabbitMQ 所需的配置选项。通常我们会将这些配置选项存储在一个类中。以下是配置类(RabbitMQServiceOptions)的实现: ///...
Exception Handling in C#
Table of Contents Types of Exceptions Using try-catch-finally How to Avoid Exceptions 4.1 Input Validation 5.2 Custom Middleware 6.4 Handling Results 8.1 Use Descriptive Names 1. What Is an Exception in C#? In C#, an exception is an unexpected event that occurs when an operation cannot be executed as intended. Exceptions allow you to handle runtime errors gracefully and define specific actions to prevent your program from crashing abruptly.
Azure Functions in .NET (C#) - The Ultimate Fun Version 🥳
What is Azure Functions? Imagine you’re throwing a party. You have tons of guests (events) arriving at different times. Instead of hiring a full-time butler (server) to manage it all, you have Azure Functions, which is like a party planner who only shows up when needed. When a guest arrives (an event happens), the planner (your function) gets to work, does their thing, and leaves when the job is done. No hassle, no drama. Just pure serverless fun! 🥳 Why Should You Care About Azure Functions?
Part 2 - Multichannel notification system using Azure Communication Services and Azure Functions
In the first part of this topic, we setup all the Azure resources like the Azure Communication Services for Email, SMS, WhatsApp for Business and developed the Azure Functions code for the email trigger.
Capture Code Snippet Execution Time
Download SnippetDurationLogger.zip Introduction I'm sure like me, in numerous projects you've had to capture and investigate long running processes. Where you had to find the snippet of code that was causing the issue and then drilling down to see what lines where causing the latency.
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.
使用 Syncfusion .Net PDF Fram 创建 PDF 的 Azure 函数应用程序
我们有几个用例需要内部和外部用户以 PDF 格式打印内容。我们已将此功能从 DXP Web App 卸载到在 Docker 容器中运行的 Azure Function App。我们使用 Syncfusion .Net PDF Framework(注意:需要订阅)。我们的第一个用例允许您提供用于打印的端点 URL。第二个用例涉及将 XHTML 内容数组发布到端点。 创建 Azure 函数应用 在 Visual Studio 中创建一个新项目并选择 Azure Functions。 为项目命名 我这里采用默认设置: .Net 8 隔离 对于版本 Http 触发器 对于该函数,因为我们将使用 GET 和 POST 启用容器支持 因为我们将使用 Docker 功能 授权级别,因此需要功能密钥。(当在此授权级别托管在 Azure 中时,需要功能密钥才能访问端点。) 单击“创建”。 这为我们提供了基本的支架。 using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using...
Web Styles in Native Apps
Styles meant for web apps can be easily shared with native mobile/desktop apps—developers also have the flexibility to tinker with styling on the fly. MAUI UI July is a month-long community-driven initiative run by Matt Goldman, where anyone gets to share enthusiasm and passion for .NET MAUI. What’s not to like about fresh developer content every day of July? This article is a proud part of MAUI UI July to celebrate developer excitement around .NET MAUI.
CA1848 High-performance logging in .NET Framework 4.8 and .NET 5.0+
As I am primarily working with "classic" .NET Framework 4.8 professionally, a project that has migrated through the years all the way from .NET Framework 1.1 to 4.8 just this past month, I always try to figure out how to do things that works both in current .NET and last-gen .NET Framework.
Using Local Browser Storage in .NET MAUI Blazor Hybrid
This blog is part of the .NET MAUI UI July 2024 series with a new post every day of the month. See the full schedule for more. This article explores how to leverage local browser storage in a .NET MAUI Blazor Hybrid application to enhance data management and user experience. By utilizing this powerful combination, developers can create robust and efficient apps that maintain state and persist data across sessions, providing users with a smooth and responsive interface.
Integrating Logic App with Semantic Kernel: A Detailed Guide and Demo
Recently, my exploration of Semantic Kernel has also impressed me, particularly its robust integration with .NET applications and the flexibility to incorporate plugins, empowering agents to perform diverse tasks beyond simple Q&A interactions. Value Proposition of this Article The motivation behind this guide and accompanying demo application is to harness the combined potential of these two technologies.
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?
Announcement: Introducing .NET C# Inline Action for Azure Logic Apps (Standard) - Preview
We are introducing a new capability that allows developers to write .NET C# script right within the Logic Apps designer. This complements the custom code feature that we introduced previously for invoking .NET FX and NET8 functions written and deployed to a Logic App. This new capability provides the following benefits: Extending our strategy to provide a no-cliff extensibility to our low code offering giving our developers the flexibility and tools needed to solve toughest integration problems.
Building business processes with Azure Durable Functions
In cloud-native development, leveraging Azure Durable Functions and Durable Entities provide an new and interesting way to build robust, scalable workflows. Moving away from traditional development complexities, this "code-first" approach enhances productivity, streamlines onboarding, and improves code quality. In this article, we'll explore how these tools can transform your business operations, making development faster and more efficient. Traditional approaches vs.
Fo-dicom是如何实现DICOM 的网络通信功能
2024-05-10 08:57:19 DICOM的通用通信模型旨在为医疗图像和相关数据的传输和存储提供灵活和多样化的解决方案。DICOM的通用通信模型不仅仅是简单地传输和存储医疗图像和相关数据,而是提供了一种多层次、多种方式的灵活解决方案,以满足不同场景下的需求和要求。 下图显示了DICOM3.0标准的通用通信模型,该模型跨越了 网络(在线)和媒体存储交换(离线)通信。应用程序可利用以下任一传输机制: DICOM 消息服务和上层服务,它们独立于特定的物理网络通信支持和协议(如 TCP/IP)。 DICOM Web 服务 API 和 HTTP 服务,允许使用通用超文本和相关协议来传输 DICOM 服务 基本 DICOM 文件服务,它提供独立于特定媒体存储格式和文件结构的存储介质访问 DICOM 实时通信,提供基于 SMPTE 和 RTP 的 DICOM 元数据的实时传输。...
Blazor WebAssembly 自定义用户登录进行授权
主要是前面四步,第五步是需要授权验证画面的书写参数。 1. 引用 Microsoft.AspNetCore.Components.Authorization 2. Program.cs 加入: var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.Services.AddAuthorizationCore();//There is no registered service of type 'Microsoft.AspNetCore.Authorization.IAuthorizationPolicyProvider' builder.Services.AddSingleton<AuthenticationStateProvider, MyAuthenticationStateProvider>(); 3.
Ensuring Software Excellence with Testing Your Code
In the field of software engineering, the term testing code holds diverse implications. It may refer to assessing how well an application functions under intense workload (load testing), confirming individual segments perform as anticipated (unit tests), or validating diverse segments collaborate seamlessly (integration testing), among other concepts. Thanks for reading Next Generation Technology! Subscribe for free to receive new posts and support my work.
How to Test Logging with FakeLogger
I originally posted this post on my blog a couple of weeks ago. It's part of an ongoing series I've been publishing, called Unit Testing 101. Starting with .NET 8.0, we have a better alternative for testing logging and logging messages. We don't need to roll our own mocks anymore. Let's learn how to use the new FakeLogger<T> inside our unit tests. .NET 8.0 introduces FakeLogger, an in-memory logging provider designed for unit testing.
.NET 8使用日志功能以及自定义日志提供程序
日志级别 下表列出了 LogLevel 值、方便的 Log{LogLevel} 扩展方法以及建议的用法: 展开表 LogLevel “值” 方法 描述 Trace 0 LogTrace 包含最详细的消息。 这些消息可能包含敏感的应用数据。 这些消息默认情况下处于禁用状态,并且不应在生产中启用。 调试 1 LogDebug 用于调试和开发。 由于量大,请在生产中小心使用。 信息 2 LogInformation 跟踪应用的常规流。 可能具有长期值。 警告 3 LogWarning 对于异常事件或意外事件。 通常包括不会导致应用失败的错误或情况。 错误 4 LogError 表示无法处理的错误和异常。 这些消息表示当前操作或请求失败,而不是整个应用失败。 严重 5 LogCritical 需要立即关注的失败。 例如数据丢失、磁盘空间不足。 无 6 指定不应写入任何消息。 一、使用log4net 在项目中使用程序包管理器控制台安装log4net包 Install-Package log4net 如果在AspNetCore项目还需要安装...
在.NET中通过官方Logging将日志保存到数据库方法(以MySQL为例)-51CTO.COM
2024-03-04 08:18:55 在这个示例中,我将详细介绍如何使用Microsoft.Extensions.Logging将日志保存到MySQL数据库。我们将使用Entity Framework Core来与MySQL数据库进行交互。 在.NET中,Microsoft.Extensions.Logging是一个灵活的日志库,它允许你将日志信息记录到各种不同的目标,包括数据库。在这个示例中,我将详细介绍如何使用Microsoft.Extensions.Logging将日志保存到MySQL数据库。我们将使用Entity Framework Core来与MySQL数据库进行交互。 首先,我们需要创建一个.NET Core项目。你可以使用Visual Studio、Visual Studio Code或者命令行工具来创建项目。在创建项目时,确保选择一个合适的项目类型,比如控制台应用程序或Web应用程序,以便测试和演示日志记录到MySQL数据库的功能。 为了能够将日志记录到MySQL数据库,我们需要安装一些必要的NuGet包。打开项目的.csproj文件,添加以下包引用:...
实战教学:用Semantic Kernel框架集成腾讯混元大模型应用
导语 | 众所周知,Semantic Kernel 主要支持国外的两款大模型,但这对于开发者而言,显然是不够的,尤其是当我们希望对接国内的大模型时,我们应该怎么做呢?如何用 Semantic Kernel 通过 oneapi 来集成腾讯混元大模型应用?今天,我们特邀智用人工智能应用研究院 CTO 张善友老师,他将为我们带来手把手实战教学。 张善友,智用人工智能应用研究院 CTO,毕业于兰州大学数学系,专注于云原生开发,推崇开源文化, 使用开源软件构建云原生软件系统,运营微信公众号“dotNet 跨平台”和 "新一代智能应用",推广和普及云原生技术在企业业务开发的应用。 从事 .NET 平台开发 20 年,业余爱好写作,在个人技术博客上撰写了大量的系列技术文章,并在腾讯云开发者社区开设专栏。 腾讯混元大模型(Tencent Hunyuan)是由腾讯研发的大语言模型,具备强大的中文创作能力,复杂语境下的逻辑推理能力,以及可靠的任务执行能力。具体参见:腾讯混元大模型-腾讯云 (http://tencent.com)。 Semantic Kernel(简称SK)是一个轻量级的...
Blazor 混合开发_MAUI+Vue_WPF+Vue
Blazor 混合开发_MAUI+Vue_WPF+Vue 背景 混合开发的核心 为什么必须使用 wwwroot 文件夹放置 Web 项目文件 创建 MAUI 项目 创建 wwwroot 文件夹 服务注册 创建 _import.razor 添加 Main.razor 组件 修改 MainPage.xaml 文件 创建 WPF 项目 创建 wwwroot 文件夹 服务注册 创建 _import.razor 添加 Shell.razor 组件 修改 MainWindow.xaml 文件 创建 Vue 项目 修改创建好的 Vue 项目 执行 npm run build 命令 Copy dist 修改 index.html 内容 效果预览 Demo 下载 背景 在 MAUI 微软的官方方案是使用 Blazor 开发,但是当前市场大多数的 Web 项目使用 Vue、React 等技术构建,用Blazor重写整个项目并不现实。 Vue 是当前流行的 Web 框架, 简单来说是一套模板引擎,利用 “模板” 和 “绑定” 两大特性实现Web页面 MVVM 模式开发。利用 .NET MAUI...
Is Blazor the Future of Everything Web?
In this article we’ll learn how .NET 8 has changed Blazor’s position in the market with features that have modernized and future-proofed the framework for years to come. This blog article was published as part of the C# Advent 2023. This annual event inspires authors and content creators to produce 50 new pieces of content for the .NET community just in time for the holiday season. Saying that Blazor is the future of everything web is a bold statement.
在.net中通过自定义LoggerProvider将日志保存到数据库方法(以mysql为例) - 架构师老卢 - 博客园
在.NET中, Microsoft.Extensions.Logging是一个灵活的日志库,它允许你将日志信息记录到各种不同的目标,包括数据库。在这个示例中,我将详细介绍如何使用Microsoft.Extensions.Logging将日志保存到MySQL数据库。我们将使用Entity Framework Core来与MySQL数据库进行交互。 首先,我们需要创建一个.NET Core项目。你可以使用Visual Studio、Visual Studio Code或者命令行工具来创建项目。在创建项目时,确保选择一个合适的项目类型,比如控制台应用程序或Web应用程序,以便测试和演示日志记录到MySQL数据库的功能。 为了能够将日志记录到MySQL数据库,我们需要安装一些必要的NuGet包。打开项目的.csproj文件,添加以下包引用: <ItemGroup> <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" /> <PackageReference...
Build and deploy .NET 8 Blazor WASM apps with serverless APIs using Azure Static Web Apps
With the release of .NET 8, Blazor has evolved from a client-first web UI framework to a full-stack web UI framework. This announcement introduced new rendering modes and interactivity, allowing more flexibility to choose the right rendering mode for your Blazor web apps.
MAUI Blazor 如何通过url使用本地文件
前言 上一篇文章 MAUI Blazor 显示本地图片的新思路 中, 提出了通过webview拦截,从而在前端中显示本地图片的思路。不过当时还不完善,随后也发现了很多问题。比如, 不同平台上的url不统一。这对于需要存储图片路径并且多端互通的需求来说,并不友好。至少 FileSystem.AppDataDirectory 和 FileSystem.CacheDirectory 下的文件生成的url应该统一。 音频文件和视频文件无法使用。理论上可以用于各种文件,但是音频和视频不能播放,应该是需要相应的处理 Windows上有限制。大于9~10M的图片不显示 iOS/ Mac有跨域问题。尤其是调用用于截图的js库,图片会由于跨域不出现在截图中 所以,在这篇文章中,对这个思路进行完善,使之成为一个可行的方案。 例如 <img src='appdata/Image/image1.jpg' > 会显示 FileSystem.AppDataDirectory 文件夹下的 Image 文件夹下的 image1.jpg 这个图片 <video...
ASP.NET Core 中的 Razor Pages
Razor Pages Razor Pages 是基于页面的 ASP.NET Core Web App 架构。 相比 MVC 模式,Razor Pages的生产效率更快。 Razer Pages 需要两个中间件: builder…Services.AddRazorPages 添加 Razor Pages services app.MapRazorPages 添加 Razor Pages endpoints 在最简单的页面中: @page <h1>Hello, world!</h1> <h2>The time on the server is @DateTime.Now</h2> 看起来与 MVC 的页面差不多,但特别之处是有一个 @page 指令,@page 指令意味着这个页面可以直接接收 http request,而不需要通过 controller。 第2个页面Pages/Index2.cshtml 的代码是这样的: @page @using RazorPagesIntro.Pages @model Index2Model <h2>Separate page...
bh004- Blazor hybrid / Maui 使用 BootstrapBlazor UI 库快速教程
源码 <PackageReference Include="BootstrapBlazor" Version="7.*" /> <PackageReference Include="BootstrapBlazor.FontAwesome" Version="7.*" /> wwwroot/index.html 在宿主文件中增加主题样式表 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" /> <title>bh004_BootstrapBlazorUI</title> <base href="/" /> <link href="_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css"...
.NET Core 实现日志打印输出在控制台应用程序中
在本文中,我们将探讨如何在 .NET Core 应用程序中将日志消息输出到控制台,从而更好地了解应用程序的运行状况。 .NET Core 实现日志打印输出在控制台应用程序中 在 .NET Core 中,日志输出打印是使用 Microsoft.Extensions.Logging 命名空间中的类和方法实现的。首先,我们需要确保在项目中添加了以下必要的依赖包: Microsoft.Extensions.Configuration: 用于读取配置文件。 Microsoft.Extensions.Configuration.Json: 用于从 JSON 文件加载配置。 Microsoft.Extensions.DependencyInjection: 用于依赖注入。 Microsoft.Extensions.Logging: 用于日志记录。 Microsoft.Extensions.Logging.Console: 用于在控制台中输出日志。 现在,让我们来看一下如何在 .NET Core 控制台应用程序中实现日志输出打印 步骤 1:读取配置文件...
WPF使用依赖注入_紫云星的博客-CSDN博客
现在依赖注入在.Net里面已经普及,自己常写一些简单的demo倒是无所谓,但偶尔写一点正式的工程,也免不了要使用一下,于是总结了一下在WPF里面使用依赖注入。 在写简单Demo时候,通常是在MainWindow的构造函数里面直接做初始化,各种变量也都丢在MainWindow类里面。在使用依赖注入后,我发现在App里面完成一些初始化内容更合适,包括MainWindow也通过容器生成,需要注意的是,记得把App.xaml中的 StartupUri更改为 Startup,并把值改为自定义的启动函数,在启动函数里面调用MainWindow的Show方法。 App.xaml.cs using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog; using NLog.Extensions.Logging; using System; using...
Microsoft.Extensions.Logging.ILogger实现按类名写入不同的日志文件-CSDN博客
使用Microsoft.Extensions.Logging框架可以很方便地实现按类名写入不同的日志文件。你可以通过配置LoggerProvider来实现此功能。下面是一个示例代码,演示如何按类名将日志写入不同的日志文件: using Microsoft.Extensions.Logging; using System; public class ClassNameLoggerProvider : ILoggerProvider { private readonly string logFolderPath; // 日志文件夹路径 public ClassNameLoggerProvider(string folderPath) { logFolderPath = folderPath; } public ILogger CreateLogger(string categoryName) { var className = categoryName.Substring(categoryName.LastIndexOf(".") + 1); // 获取类名 var logger =...
.net Core Api 注入 Microsoft.Extensions.Logging
ILoggerAdapter.cs using System; using System.Collections.Generic; using System.Text; public interface ILoggerAdapter<T> { // // Summary: // Formats and writes an informational log message. // // Parameters: // message: // Format string of the log message in message template format. Example: // "User {User} logged in from {Address}" // // args: // An object array that contains zero or more objects to format.
How to Add Authentication to .NET MAUI Apps
Register for an Okta workshop in OIDC, SCIM, Workflows, and Terraform! Have you ever been inspired by a colleague’s work and decided to explore a new tool or technology?
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.
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