Best New Feature of ASP.NET Core 2.2

Well a few days ago, Microsoft officially announced ASP.NET Core 2.2. In this article I will discuss about the best new features that are owned by the ASP.NET Core 2.2 version.

Health Checks

ASP.NET Core 2.2 introduces a range of new features. One of the more interesting (IMO) is Health Checks. You may use tools like Pingdom or elmah.io Uptime Monitoring to ping your website in a specified interval. Pinging a single HTML page may or may not reveal if your application is healthy or not. Health Checks to the rescue! Before trying out the code yourself, make sure to install the recent version of ASP.NET Core 2.2 and Visual Studio 2017.

"Lambda" health checks

Simpler type are "lambda" checks. To register such check one needs to call AddCheck (or AddAsyncCheck for asynchronous version) which takes function as a parameter. This function needs to return HealthCheckResult. An instance of HealthCheckResult carries a true or false value (which maps to failed or passed) and optionally a description, exception and additional data. The value will be used to determine the status of health check, while optional properties will end up in logs.

"Concrete Class" health checks

An alternative way to represent a health check is through a class implementing IHealthCheckinterface. This gives a lot more flexibility, starting with access to DI. This ability is crucial for the second health check I wanted to implement - Redis instance connection check. Checking the connection requires acquiring RedisCacheOptions and initializing ConnectionMultiplexer based on that options. If the connection is created with AbortOnConnectFail property set to false, ConnectionMultiplexer.IsConnected can be used at any time to get current status.

HTTPREPL

So, what we are doing in ASP.NET Core 2.2 is there is a new tool which name is “httprepl”. It’s a dotnet core global tool that you can install in your machine and that gives you a command line repl for interacting with API endpoints.

SignalR Java Client

In ASP.NET Core 2.2 they are introducing a Java Client for SignalR. The first preview of this new client is available now. This client supports connecting to an ASP.NET Core SignalR Server from Java code, including Android apps.

The API for the Java client is very similar to that of the already existing .NET and JavaScript clients but there are some important differences to note.

The HubConnection is initialized the same way, with the HubConnectionBuilder type.

Conclusion

With ASP.NET Core 2.2, you should be able to run ASP.NET Core applications in-process in IIS, giving a significant performance boost. Health monitoring can allow near-real-time information about the state of your containers and microservices. The ASP.NET Core team is building a REPL that lets you explore and interact with your RESTful services. Ideally, your services will have Swagger/OpenAPI available that describes the service. SignalR for ASP.NET Core supports any server platform that ASP.NET Core supports.

These new features hopefully answer all requests so far. If you are looking for a reliable Windows hosting that supports full ASP.NET Core 2.2, you can consider ASPHostPortal.

Rate this post
error: Content is protected !!