A solution template using Clean Architecture for building a .NET Core 3.1 Worker Service.
If you like or are using this project to learn or start your solution, please give it a star. Thanks!
Big thanks to all of the great contributors to this project!
Install the ef core cli tools dotnet tool install --global dotnet-ef
. If you already have an old version, first try dotnet tool update --global dotnet-ef --version 3.1.0-*
, if that doesn't work, see Updating Ef Core Cli First, delete C:\Users{yourUser}.dotnet\tools.store\dotnet-ef tool.
This app is currently configured to run against a localdb SQL Server instance. To configure this, you will need to run dotnet ef database update
in the src\CleanArchitecture.Worker folder before running the app.
Check the connection string in appsettings.json
in the CleanArchitecture.Worker project
Clone or download the repository. Open it in Visual Studio and run it with ctrl-F5 or in the console go to the src/CleanArchitecture.Worker
folder and run dotnet run
.
On startup the app queues up 10 URLs to hit (google.com) and you should see it make 10 requests and save them to the database and then do nothing, logging each second.
To use this as a template for your own worker server projects, make the following changes:
- Rename CleanArchitecture to YourAppName or YourCompany.YourAppName
- Configure the connection string to your database if you're using one
- Replace InMemory queue implementations with Azure, AWS, Rabbit, etc. actual queues you're using
- Remove UrlStatusHistory and related services and interfaces
- Clean Architecture template for ASP.NET Core solutions
- Creating a Clean Architecture Worker Service Template (Twitch Stream 1)
- Creating a Clean Architecture Worker Service Template (Twitch Stream 2)
Useful Pluralsight courses: