Skip to content

Coding Practice

How to Run a Background Task Inside Your ASP.NET Core Application

We needed a simple solution to run recurring jobs for our user group web site. WebJobs in Azure sounded like the perfect solution, but unfortunately they do not work with App Services on Linux. We needed another approach and we found a much better solution with Background Tasks. All we need to do is to implement the two interfaces IHostedService and IDisposable, and the worker runs outside of the requests to our application.

Serve Test Data From ASP.NET Web API in .Net 8

If you need an API endpoint that gives you some (static) test data, you can join the search for the most complicated solution. My current favourite in unnecessary complexity is to use MongoDB to serve a handful of JSON objects.

However, if you prefer a much lighter approach and already use .Net, I strongly recommend that you try Web API for this task. It only takes a few lines to get your data in a format that you can access from your application. And if you want to keep going on, you can add more functionality with ease.

How to Create a QR Code with .Net 6+

QR codes are a nice way to supply your users with an URL without letting them type it into their mobile devices. All they need to do is to point their camera to the QR code and scan it. There are many libraries to create QR codes with .Net. Unfortunately, not all are working with .Net 6 and newer. In this post we explore a user-friendly library that works with .Net 6 and .Net 7.

How to Fix ERR_SSL_VERSION_OR_CIPHER_MISMATCH for Your NuGet Feeds on Azure DevOps

We run into a strange error last week when we no longer could install NuGet packages from our Azure DevOps feed. Visual Studio only gave us a basic error message about SSL connections, but to get some details we needed to run dotnet restore:

error : The SSL connection could not be established, see inner exception. error : Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'.

How to Create a Dev Container for Asciidoctor

We use AsciiDoc as the format for our documentation for the user group project. AsciiDoc is a bit like Markdown, but it supports multi-file documents out of the box and without any quirks.

We use the Ruby app Asciidoctor to turn our AsciiDoc files into a PDF as part of our build job. Since building the whole application takes time, it is not the fastest way to get feedback when we write the documentation. To shorten the feedback cycle, we put Asciidoctor into a development container to create the PDF whenever we want to check something.