I’m working on a .NET Core application using the CQRS pattern with MediatR, and I’m confused about the real difference between a Handler and a Service.
Both seem to contain business logic, but the usage pattern looks different:
Services are reusable classes used across multiple areas.
Handlers execute one specific command/query (ex:
CreateUserHandler,UpdateOrderHandler).
My doubts:
Should business logic be placed inside the Handler directly, or inside a Service and called by the Handler?
When is it appropriate to create a Service instead of putting everything inside a Handler?
Is it considered bad practice if my handlers become big?
Do services still make sense if I’m using strict CQRS with MediatR?
I want to keep my architecture clean and follow best practices, so what’s the recommended approach?

Sam HobbsPosted Nov 21, 2025, 3:14 AM
If you ask AI then you are likely to get your questions answered.
I am not familiar with the CQRS pattern with MediatR but in general a handler is for just one event and a service does many things.
Using AI I learned that for your context a handler is executed for a specific command or query. A service can have:
business logic that doesn't fit in a single handler
logic that can be reused for multiple handlers
provide a layer between handlers and other things such as databases
Darshan AdakanePosted Jan 6, 2026, 11:03 AM
First of all its a very good question.
I would second Sam's answer.
If you have singular task/function to be executed once a event occur, Handler is the way to go.
If you have multiple tasks to run under certain functionality, Service would be good approach to go.
Hope this quick snapshot answer helps.
Vishal GamiPosted Nov 24, 2025, 1:13 PM
In .NET, "Handler" and "Service" generally refer to different architectural concepts and functionalities: a handler processes a specific, singular event or request, while a service is a broader, often long-running component that orchestrates business logic or background operations.
Key DifferencesPractical Use Cases
Handlers
HTTP Request Processing: In classic ASP.NET, an
IHttpHandleris responsible for processing incoming web requests and generating responses.Event/Message Handling (CQRS): In modern architectures (especially with CQRS or MediatR libraries), a
GetCustomerQueryHandlermight handle a specific query object to retrieve data, working with services or repositories to fulfill the request.Pipeline Components: Message handlers can be inserted into an HTTP client pipeline to perform cross-cutting concerns like logging, authentication, or caching for specific requests.
What is the difference between a service class and a handler ...
Oct 30, 2020 — Comments Section * tester346. • 5y ago. It's up to the author of that class. Generally there are very "generic" terms ...
Reddit
HTTP Handlers and HTTP Modules Overview | Microsoft Learn
Oct 22, 2014 — An HTTP handler can be either synchronous or asynchronous. A synchronous handler does not return until it finishes pro...
Microsoft Learn
Services
Business Logic Layer: A
UserServicemight contain all the methods related to user management (creating, updating permissions, etc.), which are then called by various handlers or controllers.Background Tasks: A
BackgroundServiceorIHostedServiceruns continuous, non-interactive tasks like monitoring a queue, performing scheduled cleanup, or processing data in the background, independent of user interaction or an HTTP request lifecycle.External Integration: A service might be used to abstract interactions with an external system (e.g., a payment gateway or a logging service).
Summary
The distinction is less about rigid technical rules and more about logical separation of concerns. Handlers are the "entry points" or "event responders", focused on input/output and delegation. Services are the "workhorses" that contain the reusable business logic and can operate in various contexts, including long-running background processes