Clean way to add Startup class in ASP.NET Core 6
If you are following ASP.NET Core 6, then probably you are aware that with ASP.NET Core 6.0 projects, there is no Startup.cs file. It is now combined with Program.cs file to bring unified experience. I posted about How to Add Startup.cs in ASP.NET Core 6 Project and this approach brings Startup.cs class in the project in a traditional way that we have today with ASP.NET Core 5 and it’s prior version. But what if we can improve things and make it better. Well, in this post, let’s take a look at a clean way to add Startup class in ASP.NET Core 6 projects.
How to add Swagger to ASP.NET Core 6 Application
Swagger is very popular and doesn’t need an introduction. It helps you to test your API. Earlier, I posted about how to add Swagger to ASP.NET Core 2.0 web API and those steps still works for ASP.NET Core 5 based applications where you bring Swashbuckle nuget packages and then add code to Startup.cs file to enable Swagger. But with ASP.NET Core 6, things have become a little easy and time saving. Now you can easily add swagger to ASP.NET Core 6 application with a mouse click.
Understanding PathBase in ASP.NET Core
In this post I'll describe a lesser-known property on HttpRequest called PathBase. I describe what it does, when it's useful, and how to use it.
Response Caching in ASP.NET Core
In this article, we are going to discuss how response caching works in ASP.NET Core.
How to Block IP Addresses in ASP.NET Core Web API
In this article, we are going to learn how to block IP addresses in ASP.NET Core Web API. This demo makes use of the reverse proxy tool ngrok when testing, but you can use your local IP address as well. If using ngrok for the first time, you will be required to sign up for a free account.
How to Add Startup.cs in ASP.NET Core 6 Project
With ASP.NET Core 6.0 projects, you will not find Startup.cs file. By default, this file is removed and Program.cs is the new place where you need to register your dependencies and Middleware. But if you are a fan of Startup.cs or upgrading your project to ASP.NET Core 6.0, you might want back the Startup.cs file. So in this post, let’s find out how to add Startup.cs in ASP.NET Core 6 project.
Implementing API Gateway with Ocelot in ASP.NET Core
In this article, we are going to learn how to implement an API Gateway using Ocelot. Ocelot is an open-source API Gateway, designed for microservices architecture. We already have an article about API Gateway, where we explained a lot about this subject. So, if you are not that familiar with the topic and microservices overall, we strongly suggest reading the linked article first.
Asp.Net Core 7 preview 4 重磅新特性--限流中间件
限流是应对流量暴增或某些用户恶意攻击等场景的重要手段之一,然而微软官方从未支持这一重要特性,AspNetCoreRateLimit这一第三方库限流库一般作为首选使用,然而其配置参数过于繁多,对使用者造成较大的学习成本。令人高兴的是,在刚刚发布的.NET 7 Preview 4中开始支持限流中间件。UseRateLimiter尝鲜安装.NET 7.0 SDK(v7.0.100-preview.4)通过nuget包安装Microsoft.AspNetCore.RateLimiting创建.Net7网站应用,注册中间件全局限流并发1个app.UseRateLimiter(new RateLimi...
Testing ASP.NET Core gRPC services in JetBrains Rider
I was recently chatting to Dan Clarke for the Unhandled Exception podcast, and the topic of testing gRPC endpoints came up. Dan wondered if there was an equivalent of Postman for gRPC, and it turns out that Postman itself supports gRPC!
How to Return HTML From ASP.NET Core Web API
A typical web API returns JSON or XML responses. However, rare cases exist where we need to return responses in other formats. In this article, we are going to learn how to return HTML from ASP.NET Core Web API. We will also state some use cases for this type of API.
How to Add Multiple POST Actions in ASP.NET Core Web API
In this article, we are going to see how to add multiple POST actions to our Web API controller. For the demonstration, we are going to use the .Net 6 Web API project.
Long-Running Tasks in a Monolith ASP.NET Core Application
Often we come across scenarios where invoking a Web API endpoint triggers long-running tasks. In this article, we’re going to explore the different ways we can implement such a long-running task in an ASP.NET Core Web API.
Why isn't my ASP.NET Core app in Docker working?
In this post I describe a problem I ran into the other day that had me stumped briefly—why doesn't my ASP.NET Core app running in Docker respond when I try and navigate to it? The problem was related to how ASP.NET Core binds to ports by default.
Distributed Caching in ASP.NET Core
In this article, we are going to learn what Distributed Caching is and how to implement distributed caching in an ASP.NET Core application.
Combining Bearer Token and Cookie Authentication in ASP.NET
And we're back for another episode in the seedy TV drama that is ASP.NET Authentication. In today's show we'll discuss the mysterious case of combining multiple authentication schemes in a single application. Tune in at 11 for the scary conclusion...
Optional Parameters in ASP.NET Core Web API Routing
In this article, we are going to look at how to use optional parameters in ASP.NET Core Web API routing. Additionally, we are going to learn how to use optional parameters with route constraints.To download the source code for this article, you can visit our GitHub repository.Let’s start...
Health Checks in ASP.NET Core
In this article, we are going to look into Health Checks in ASP.NET Core. Then we are going to look into the Health Checks Middleware provided by ASP.NET Core to create some checks and add a nice dashboard to view all our Health Checks. Finally, we will briefly look at some ways to make our Health Check endpoints more secure.
Using MassTransit with RabbitMQ in ASP.NET Core
In this article, we are going to take a look at how we can use the open-source, distributed application library MassTransit in conjunction with RabbitMQ in an ASP.NET Core application. First, we are going to cover some of the more advanced RabbitMQ features, as well as some of the concepts we will come across in the MassTransit library. Finally, we will learn how to use these libraries in an ASP.NET Core Web API application.
How to Use RabbitMQ in ASP.NET Core
In this article, we are going to take a look at using a message broker, RabbitMQ, with an ASP.NET Core Web API application. Message brokers are applications that allow other applications to send and receive messages in an asynchronous manner. As a result of this, we can build highly scalable, decoupled applications that don’t rely on synchronous actions, such as HTTP, to communicate. We can use any binary encoded data as a message to send between one application to another.
Rate Limiting in ASP.NET Core Web API
In this article, we’re going to talk about Rate Limiting in ASP.NET Core and explore some ways of implementing it.