loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.58k stars 644 forks source link

Run alongside another AspNetCore application instead of a separate application #701

Closed Dunge closed 2 years ago

Dunge commented 2 years ago

I wish to have both a nuget server and my own web application running the same port 80/443.

IIS is usually used to be able to configure multiple applications on the same web server, but in my case my website use a feature (gRPC) IIS does not support in Windows Server 2019, so I have to switch to Kestrel web server instead, which only runs one application at once.

Would it be possible to have BaGet as a service (nuget library) instead of a separate executable so that it could live alongside another application in the same Kestrel server? I'm thinking of a service registered in the ServiceCollection DI container like:

services.AddBaGet(options => { options.Path = "/BaGet" });
Dunge commented 2 years ago

Forget this, I believe using a reverse proxy to redirect to the proper application to be a better solution.

loic-sharma commented 2 years ago

Yup this is possible. Here are some examples:

However please note that BaGet's APIs are not stable yet. If you embed BaGet into your app you will need to handle breaking changes.

Dunge commented 2 years ago

Thanks. I personally won't use it, as I said before it's ridiculous trying to bundle lots of applications in one big project, I rather use a reverse proxy and keep separate web servers. But I do appreciate you taking the time to reply, and that sample seems quite clear and easy.