Replies: 4 comments 2 replies
-
.... do you actually need a webserver backend for the web frontend? As opposed to a static web page that makes API calls to the bot backend (and yes, this can be secured appropriately). That aside, is there a reason you're not just serving this as "one" application? Just under different urls on the same host. |
Beta Was this translation helpful? Give feedback.
-
Yeah I do like the idea of using a lightweight web server to host the web frontend, I want to have it just as regular Razor Pages not a client-heavy API calling thing. If you're referring to I don't understand what you're talking about with restarting the container and accessing the host controller. Could you give some examples? I could probably put it all one one host, but it feels wrong to me because that host would presumably have to be a web host, to allow the web frontend. That makes the whole thing feel like a website with a bot service on the side, rather than what it really is, which is the inverse. |
Beta Was this translation helpful? Give feedback.
-
Not sure why you're assuming it's gonna be in a Docker container.
Interesting... I tried using that by creating a container class for a CTS and CT, using the CT as the argument, then pulling in the class and triggering the CTS to shutdown all the hosts, and it worked:
... then, to start the hosts:
And to exit the program from within a host's service:
Does this look sensible or have I "rolled my own" version of a mechanism that already exists? |
Beta Was this translation helpful? Give feedback.
-
It's not a bot that offers a web API, it's a Telegram bot actually. So it's doing the polling, it's not providing any web services (the web UI is intended to just be for administration). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm coding a bot with a web interface, and I'm wondering whether it's appropriate for me to use multiple hosts within one program to host the two separate background tasks - the bot's long-term functionality, and the web server for the web frontend. I've created a solution with a bootstrap project and separate projects for the bot and web parts, and put the following in my bootstrap project's
Main
:I'm not sure whether this is a supported workflow, though. The problem I'm coming across is that I want to be able to shut down the entire application from just one host. I've tried pulling in
IHostApplicationLifetime
into theService
host'sBackgroundService
and calling.StopApplication()
and it only stopsbotHost
but notwebHost
. Is there a way I can get this to work or am I only ever supposed to have one host for a program?Beta Was this translation helpful? Give feedback.
All reactions