Follow the instructions in the error message and set the application to development environment on the server. Probably the easiest is updating the web.config file on the server. https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/web-config?view=aspnetcore-8.0#set-environment-variables
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-8.0
ASP.NET Core 2.1 is no longer supported. You should move to a newer LTS version.