If you want one of our "projects" to be considered as a web project it has to be a web server. In .net-core web servers created like this:
var builder = WebApplication.CreateBuilder(args);
. Then you can add Startup.cs
and configure each server independently. But it's going to be hard to achieve redirecting functionality you mentioned and you also would have to solve problems with deploying of such services and managing them.
As I understood from your question, you really want only one of your projects to be a web server (MainWeb
). Then, rest of your projects could be just class libraries containing controllers in them. You can register controllers to MainWeb
by following this answer.
What is usually is a general practice is that you have one Web Server containing all controllers (if you want you can move them in different namespaces). In each controller you call appropriate service (or command, or request executor, depending which pattern do you use). This services could be stored in different class libraries. For example:
Mainweb.csproj (web server)
- Controllers
- - Accounting
- - - AccountingController.cs
Startup.cs
Program.cs
AccountingProcessor.csproj (class library)
- RequestProcessors
- - AccountingRequestProcessor.cs
Here, MainWeb references AccountingProcessor. Accounting processor does the logic for all accounting requests.
If you don't have any other restrictions which require you to have these projects to be a web, I would choose this option.