Posts

Showing posts from December, 2018

Using custom health checks with Asp.Net Core 2.2

Image
I almost burst with cries of joy when I saw the release of .Net Core 2.2 with the much needed built in and standardized health checks. The preview was great and with each version until the release new blog posts emerged eager to show to the world the new wonder. But as I do like my frameworks fully baked and released I waited patiently for the real deal.
TL;DR Implement your own service from IHealthCheck and inject it with whatever you want. It just works!
Reading the instructions... The best article I found for the new healthcheck API was this one based on preview code and the best code samples where of course the official samples. However by looking at them something was missing. So I went on a quest to achieve what suited my needs. And my needs are simple. I need to be able to inject some testing code to my custom health check module.
On to the code After I practiced a little bit with the concept of tags I just added a health checking service to the standard DI container as such Odd…

Running an Asp.Net Core 2.* Web API as a Windows Service

Image
At my current workplace there is a healthy hunger for new technologies and a pragmatic view of the software industry in our corner of the planet. As a Microsoft driven shop, previous reservations of moving to different ecosystems and operating systems have melted away with the arrival and wide adoption of .Net Core. After all the language is the same. The developers need "only" to catch up on their containers. When I joined a month ago as a tech lead, little did I know that putting my money where my mouth is would mean having to deal with outdated Microsoft documentation or even S.O answers to questions such as "How do I run an Asp.Net Core app as a windows service without IIS".
TL;DR add a reference to the NuGet package  Microsoft.Aspnetcore.Hosting.Windowsservices, publish and register your executable as a service.
A Prophecy? Almost a year ago I wrote a blog post about porting full framework projects to core. Ever since I have written my share of .Net Core, Pytho…