ASP.Net Core RESTful Service Project Template
The repository contains a ready to use preconfigured project template for MS Visual Studio 2017 and 2019 to create fully functional production-ready cross-platform RESTful services based on ASP.Net Core 3.1/5.0.
Note 1. ASP.NET Core 3.0 has many breaking changes against version 2.2. If you want to use v2.2 or earlier, please, check out one of the previous releases, starting from version 1.3 or earlier.
Note 2. If you are looking for classic ASP.Net services with WebAPI2 and other stuff like that, please, check out a project
ASP.Net WebApi2 Application with OWIN.
This template is intended to provide you an almost all that you need for creating RESTful services. The project doesn't contain any UI stuff, like React or Angular libraries, npm, Razor views, as well as any problem domain specific things like EntityFramework, some "right" or "neat" project structure or even a number of projects, each for the specific purpose (for example, service itself, domain logic, data access, testing and so on) as does it some other templates. There are too many areas where ASP.Net Core services can be used, so it hardly can be offered anything related to domain areas to fit all of these project types.
However, some things must be implemented or configured in almost each of the projects, regardless of the subject area. Among these things are dependency injection, exception handling, logging, and others. There are many libraries and solutions to address each of them, but it is impossible to choose a set that fits absolutely everyone. In this project, I have collected the solutions that I consider the most convenient and use them for years in almost each of my projects. I hope you will like them too :). So, the project contains these the most important features, but is not limited to them:
- CORS and preflight requests support
- Autofac as a DI-container
- AutoMapper
- Serilog as a default preconfigured logger
- Unhandled exceptions handling
- Swashbuckle for API documentation
- Ability to use environment variables in configuration options and support for '.env' files to easy switching between different environments (thanks to DotNetEnv)
- ... and some boilerplate code
Read Wiki for more information.
Let me know, what do you think. Any suggestions and bug reports are very appreciated.
Release Notes
Date |
Version |
Release Notes |
2021-05-03 |
2.6 |
- Support of .Net 5.0 - Add dotnet new custom template |
2021-03-07 |
2.5 |
- Minor fixes |
2021-02-27 |
2.4 |
- Improve logging |
2021-02-23 |
2.3 |
- Load .env before Serilog initialization to make it possible to use environment variables in Serilog configuration options - Catch and log unhandled exceptions - Update NuGet packages to the latest versions |
2020-08-14 |
2.2 |
- Allow Swagger to work behind a proxy - Improve Application Settings with Options Pattern and Configuration Extensions - Update NuGet packages to the latest versions |
2020-01-22 |
2.1 |
- Fix deploying to IIS - Fix publishing the service |
2020-01-22 |
2.0 |
- Change target framework to .Net Core 3.1 - Add health check service |
2020-01-21 |
1.3 |
- Update target framework to .Net Core 2.2 |
2019-08-22 |
1.2 |
- Project tags are added to make it simple to find this project template in a VS2019 project creation wizard - Update NuGet packages to the latest versions |
2019-04-03 |
1.1 |
- Support VS2019 |
2019-01-21 |
1.0 |
- Initial version |