Image of laptop and printed reports
Image of laptop and printed reports

Imagine having an ASP.NET Core based application deployed to Azure App Service when suddenly the customer wants you to add PDF reporting to the application. Now what?

There are a lot of libraries, tools and even SaaS solution to reach that goal, so we’ll have to pick a feasible solution for the given use-case. In this article I’ll be giving a short overview of some available options I came across and when to pick what.

After selecting the right solution, we’ll have a deep dive into the implementation. Spoiler: we will be implementing server-side PDF generation using a wkhtmltopdf-based approach.

Options


Agreed, printing is a thing from the past and we should think about the environment and save as much 🌳🌳🌳 as possible. However, if you’re like me, developing software for production environments, sooner or later you’ll have to get something out on paper. Preferably fully automated.

So how do we actually silent print PDF files from a Windows service? Seems like there are some ways to make this happen.

Solutions found in the wild

  • 2printer
  • Adobe Acrobat Reader
  • Foxit PhantomPDF

The solutions mentioned above all depend on calling an executable providing little or no feedback from the print process. Some tools, like 2printer, check their…


Introduction

It’s that time of year again to tidy up my desk. Always a nice period in which to find back some lost treasures. I just came across this HUZZAH32 feather board which I bought +/- a year ago. This is a tiny programmable board hosting an ESP32 System-on-Chip (SoC) micro-controller.

The ESP32 is the successor of the famous ESP8266 which are both WiFi enabled micro-controllers. The fact that they have WiFi on-board make them very interesting and useful.

As an example: I’ve built this Playmobil®-house for my two daughters where they can dim the light in each room separately using…


Certificate renewal can be a tedious job, especially when deploying multiple IIS Web applications. The reason for this is because the IIS Web App Manage task in the release pipeline needs the SSL certificate thumbprint to know which certificate to use in the HTTPS binding. Whenever the certificate is renewed, the old thumbprint needs to be replaced by a new one for each deployment/release pipeline.

In this post we’ll see how we can use a Variable group to define the SSL certificate thumbprint once and use it during the deployment step.

Create a variable group

  1. Open the Library tab on the left to see…

Introduction

In this blog post, we will take a look at how we can securely authorize and authenticate our users in a Single-Page application (SPA). We’re specifically talking about browser-based JavaScript applications running on the same domain as the API.

First we had cookies, then we had tokens and now it looks like we’re back to cookies.

Let’s take a closer look to the options and zoom in on the relevant parts.

The options

The major options for giving a user access to our web-based resources are:

  • Cookie based authentication
  • Token based authorization / authentication
  • Federated / delegated authentication (SSO)
  • Windows authentication (Kerberos…

Introduction

In this post we will see how to create a GraphQL endpoint with GraphQL.Conventions and ASP.NET Core 2.1. We will cover creating a project from scratch until the point where we add our own queries and mutations.

In GraphQL, a query is a request for data, while a mutation is a request to change data. That change data could be anything from CRUD (Create, Update, Delete) to commands (CQRS anyone?). All types, queries and mutations are described in a so called schema.

What is GraphQL.Conventions?

GraphQL.Conventions is a library that sits on top of the GraphQL .NET library. The GraphQL.Conventions library takes away…


ASP.NET Core makes it extremely easy to log information, warnings, errors and the like by injecting the generic ILogger<T> interface. However, unit-testing becomes a little bit harder, so let us see why and how we can solve this with ease.

In the examples below, we will be using the mocking framework Moq to verify that a certain message is getting logged.

Service under test

Let’s take a closer look to a service responsible for sending template based e-mails.

Example MailService

Writing the obvious test

Now, we want to make sure that an error is being logged in case _smtpMailer.Send throws an exception.

The first attempt would be…


Update as of 29 February 2020

The article below was written 2 years ago. During the last 2 years, a lot has changed regarding the tooling I have been using. I’m currently using Azure DevOps on a daily basis and it has completely replaced the need for using BitBucket, Jenkins, Octopus Deploy, own private npm or NuGet feeds as Azure DevOps has it all in-the-box. Apart from all those features, it also allows us to keep track of our Agile process using boards, user-stories, backlogs, release management and test plans. Even if you’re not a Microsoft fan-boy or you’re building Java, nodejs or other non-.NET …

Wouter Huysentruit

Software Engineer and Architect focusing on .NET and Microsoft technologies. Microsoft MVP. Practitioner of clean code. #solid #tdd #ddd #cqrs #es #graphql

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store