Upgrade ASP.NET Core and Entity Framework Core 2.0 to 2.1

In the past weeks we have upgraded our ASP.NET Core 2.0 project to 2.1. The main reason for the upgrade is using the latest signalr capabilities and hosted services. The issues we had are related to the features we use. In our case the upgrade encountered some minor issues. In this blog post I’ll show what we had to change and give some tips on how to upgrade.

When upgrading our project to the 2.1 I found that using the standard visual studio nuget manager was insufficient. The number of packages that needed an upgrade did totally crash the nuget manager. After the second try I decided that editing the package versions by hand would be far more efficient than trying to fix it with the user interface. After editing all project files I had only a few compile errors.

Compile errors
All ASP.NET Core and EF Core code was compiling fine with the new version. Only our signalr packges needed a small code change:

await _hubContext.Clients.Group(art).InvokeAsync("NotifyGroup", msg).ConfigureAwait(false);
// Replace with:
await _hubContext.Clients.Group(art).SendAsync("NotifyGroup", msg).ConfigureAwait(false);

After this all code compiled.

When starting the application we run into 2 startup problems and one javascript package we needed to upgrade.

Our middleware handler did fail on startup with the following error:

>’An error occurred when configuring the exception handler middleware. Either the ‘ExceptionHandlingPath’ or the ‘ExceptionHandler’ option must be set in ‘UseExceptionHandler()’.’

To fix this error I made the following code change:

// Replace with:

Next we got an error in the Signalr configuration:

>System.ArgumentException: ‘The path in ‘value’ must start with ‘/’.’

This one was easy to fix:

// Replace with:

After this change the ASP.NET core service worked like before. We encountered a problem in the Signalr javascript package:

>System.Net.Http.HttpRequestException: Response status code does not indicate success: 405 (Method Not Allowed).

We were using the ‘@aspnet/signalr-client’ which is deprecated from now on. So we upgraded to ‘@aspnet/signalr’. This worked without any further code changes.

Next steps
The next step is to use new feature of ASP.NET Core 2.1.

Run background processing in separate containers
We are planning to move our background services into there own containers by using the IHost and IHosted services:

Entity framework
The most important feature for entity framework for our project was the support for GroupBy. We see better query performance in these queries.

Final thoughts
Upgrading to the new version of ASP.NET Core and Entity framework 2.1 went almost seamless. Most time was consumed by the editing the project files to change the versions. All changes we made to run the new versions where done within a day.

ASP.NET Core 2.1 Roadmap
Entity framework 2.1 Roadmap


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: