Fix GET /apple-touch-icon.png 404

After successfully publishing my first Blazor app, I started getting a bunch of 404 errors on my application insights dashboard.

What are these errors? Why? What does this mean?

Well, it turns out, Apple devices make those requests assuming your apple-device-optimized website will contain these files. These files are used by the device when the users bookmark your site to their home screen. If you don’t provide these files, your site icon will be an ugly screenshot of your site.

Ok, how do I fix it?

It’s a simple fix, just upload a single 180x180px PNG image to your website root and declare it in the head of your site.

<link rel="apple-touch-icon" href="apple-touch-icon.png">

That’s it! Say goodbye to those 404 errors.

Blazor: Getting Started

First, what is Blazor?

Blazor is a new client-side UI framework from the ASP.NET team.

Ok, but what does this mean?

C# instead of JavaScript. Blazor allows you to build modern web applications using C#, HTML, and CSS.

WebAssembly vs Server

Blazor comes in two flavors: WebAssembly and Server. With Blazor, you can either run your code directly in the browser using WebAssembly or on the server, communicating UI using SignalR.

Getting Started

When creating a new Blazor app with Visual Studio, it will ask you to set some initial configuration.

For this case, I selected WebAssembly and checked the “ASP.NET Core hosted” checkbox, this will configure the app to use an ASP.NET Core backend.

Note: Blazor also allows you to create a Progressive Web Application out of the box, but I’ll leave this for another time.

This setup will create the following solution structure:

The solution contains a client application, a server API, and a shared library; all you need to start coding… You’ll see that there are several example files, and if you go straight and run the project, you’ll find a simple weather application that will help you get familiar with the inner workings of Blazor.

Among the example files, you’ll find a shared model in the shared library, some controllers that return some mock data on the server project, and a few pages and components in the client application… Sounds familiar, right? Blazor components are building blocks for your application; a component in Blazor is an element of UI, such as a page, dialog, or data entry form.

Karaoke App

I wanted to get some hands-on experience with Blazor, so I created a simple web application using the WebAssembly approach. It is a very straightforward application that lists and filters a song directory for a karaoke night.

The code is quite simple; client application makes a GET request to API, which reads a JSON file, deserializes it, and returns a list of songs. It is basically an alternate version of the sample application included with the template.

You can take a deeper look at the code in GitHub.

Wrap-up

Blazor is an exciting platform for web developers and a compelling alternative to the current web application frameworks. There are issues and aspects where Blazor feels not mature enough, but there is an active community of developers working to make it better and strengthen its weak points. I believe we’re going to see a lot of Blazor in the next years; we just need to wait for more developers to start creating with Blazor.

Microsoft Certification Roadmap

There are different opinions on whether professional certifications worth it. I believe in continuous learning, never stop being a student; therefore, I think certifications are an excellent incentive to keep learning.

So, getting certified has become one of my professional goals for this year. I’ve been working with different technologies throughout my career; however, Microsoft technologies have been a constant for several years. I started some research about the certification options they offered and discovered that last year, 2019, they revamped their certification program with a whole new set of role-based certifications.

Here is the path I’ve chosen; let’s hope I’ll get there soon.

Azure Fundamentals > Azure Developer Associate > Azure DevOps Engineer Expert

.NET Architecture E-Books

If you think good architecture is expensive, try bad architecture.

Recently, I’ve been looking for learning resources on software architecture, especially for .NET, and I’ve found this very good series of completely free e-books from Microsoft about software architecture. They provide a nice overview of different architecture approaches, the latest technologies and trends, like containers, CI/CD processes, cloud, microservices, and serverless applications.

You can read all of them online or download in different formats to read on any device.

Containerized Docker Application Lifecycle with the Microsoft Platform and Tools

This guide is an introduction to the recommended end to end lifecycle processes you’ll use to develop, validate, and deploy containerized Docker applications using Visual Studio and Microsoft Azure.

Modernize Existing .NET Applications with Azure cloud and Windows Containers

This guide is an introduction to the strategies you’ll need to migrate existing web applications to the Azure cloud and Windows containers. You’ll learn about code strategies, data migration, orchestrators, and CI/CD processes.

Architect modern web applications with ASP.NET Core and Azure

This guide is an introduction to the recommended architecture, design, and deployment processes you’ll use to build ASP.NET and ASP.NET Core applications and host those applications in Azure.

Architecting Container and Microservice Based Applications

This guide is an introduction to developing microservices-based applications and managing them using containers. It discusses architectural design and implementation approaches using .NET Core and Docker containers.

Serverless apps: Architecture, patterns, and Azure implementation

This is a guide for building serverless applications with examples using Azure. It discusses various architecture and design approaches, the benefits and challenges that come with serverless, and provides scenarios and use cases for serverless apps.

You can find all available e-books and downloads here.

.NET Core Exclude from Coverage

It’s great to have your code covered by tests, right? And if you’re like me, you’d like to know how much of your code gets covered, the higher this metric, the lower the chance of having undetected software bugs, assuming your tests are good quality, of course.

Sometimes you need to exclude some classes from this metric to get more accurate results according to your project specifics.

For a .NET Core project, the framework provides the attribute ExcludeFromCodeCoverage. Tag your class with it and make sure to add the import to System.Diagnostics.CodeAnalysis.

This attribute is available to .NET Core 2.0 or superior.

using System.Diagnostics.CodeAnalysis;
namespace YourNamespace
{
[ExcludeFromCodeCoverage]
public class YourClass
{
}
}

view raw
YourClass.cs
hosted with ❤ by GitHub

tired good night GIF