If you need a background task within .Net Core to be run at set times we can use the Hosted Service provided from the service within .Net Core.
Continue reading Hosted Background timer taskCategory Archives: >NET Core
Hosting a service inside ASP.NET Core
A little hidden gem within .Net Core is the ability to run a Hosted Service inside the application. This allows for your service to run in a different thread to the main application, but keeps everything together though the need to host a separate service.
Continue reading Hosting a service inside ASP.NET CoreILogger in .NET: best practices
If you are like me you will have been using ILogger in DotNet Core for some time, but you’ll have noticed there are many ways to use the logger, I found this useful article by Rico Suter going over some recommendation and best practices.
Continue reading ILogger in .NET: best practicesASP.NET Core Guidance
I came across a very good article on ASP.NET Core which I needed to bookmark, as it gives a clear and understandable guidance on keeping things working as efficiently as possible.
Continue reading ASP.NET Core GuidanceHealth Checks
Using DotNet Core comes some responsibilities, one of those is making sure your application is up and running.
Since DotNet Core 2.2 the introductions of health checks have been established.
There are two types of Health Checks
- Liveness Health Checks
- Readiness Health Checks
Sample .NET Core Docker file
Here is a working example of a simple Docker file for a .NET Core 3.1 project
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY project.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/runtime:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "project.dll"]