Hosted Workers, AI Tracing and MCP Security
Move console workers onto Generic Host, add request-level OpenTelemetry spans, secure MCP tools, and stream AI responses in ASP.NET Core.
Jasen's top three picks
- 1 Moving a Console Worker Into a Hosted .NET Background Service
C# Corner
A practical path from a console worker to managed hosting, with dependency injection, logging, and graceful shutdown.
- 2 Adding custom OpenTelemetry spans so an AI agent can see inside a request
Meziantou's blog
Custom spans can reveal request details that existing telemetry misses.
- 3 Securing MCP Tools Before Connecting Them to an ASP.NET Core Application
C# Corner
Worth reading before exposing application capabilities through MCP tools.
Editor's note
I’ve curated a mix of practical hosting, observability, security, and AI integration articles today. The hosted-service walkthrough is useful if a console worker has outgrown its original setup; the custom-spans article shows how to make request behavior more visible.
Today's articles
Moving a Console Worker Into a Hosted .NET Background Service
C# Corner
Learn how to migrate a console worker to a hosted .NET background service using Generic Host, BackgroundService, dependency injection, logging, and graceful shutdown.
Topics: .NET Core
Read articleAdding custom OpenTelemetry spans so an AI agent can see inside a request
Meziantou's blog
The three Aspire posts of this series read telemetry that was already there. The first one counted the spans of a slow request, the second one needed the logs that went with them, the third one needed...
Topics: .NET Aspire OpenTelemetry
Read articleSecuring MCP Tools Before Connecting Them to an ASP.NET Core Application
C# Corner
The Model Context Protocol (MCP) makes it easier for AI applications to interact with external tools, databases, APIs, and business services. An ASP.NET Core application can use MCP to expose capabili...
Topics: ASP.NET Core Security
Read articleUsing Microsoft.Extensions.AI for Streaming Responses in ASP.NET Core
C# Corner
AI-powered applications often need to generate long responses. For example, a chatbot may explain a programming concept, summarize a document, or analyze a large amount of information. When an applica...
Topics: ASP.NET Core
Read article