Blazor server game background task - signalr

I am making a game with blazor server (a Monopoly-like).
I need to create a background task in order to manage some states change.
I have tried:
Background Service
Timer
Everything works fine but when i am deploying my project on a IIS Server or in an Azure app service, the project is stopped if no user is connected.
The project is started again when someone comes again on the game (http connection).
My questions are:
How can i make sure IIS or Azure app service won't kill the process when no user is connected ?
Is there a best way to do that ? Should i create a dedicated project (Console Application for example or Windows service) to manage this background process ? If so, how can i "communicate" with Blazor server project ?
Thanks

Related

Why is hosting outside of IIS termed as self host?

In general, if a third service provider manages the web server for me then it is hosted, while if I am by myself managing the web server then it is self-hosting.
In ASP.NET Core, In both places, I am the one who publishes the code on the server, at the time of IIS it is not called self-hosting? what exactly does "self" means?
For me as a programmer, self-hosting means the application should be able to host itself, which means it must be able to listen to the web requests directly or it must run on its own process. Am I wrong? Please someone help me to understand the meaning of "self" in self-hosting.
Also, the image Microsoft uses to explain self-host is very confusing to me, as far as I know, IIS uses w3wp.exe to execute the application as:
The above image is good, w3wp is the process within that our app executes and IIS is the overall container.
But now, look at this image:
Here the application is the wrapper and Kestrel is within the application and the process (dotnet.exe / application.exe) is the wrapper containing Kestrel, why is it so?
For me, it should be
Why is my image different from Microsoft's image for self-hosting? Where am I missing the concept?
I think that you need to extend the concept:
Hosted is essentially an application (web app) exposed via a third party service that run a server (web server) for you.
Self hosted is the same application exposed via a server managed by you.
Sometimes, as correctly mention by Vineet, self hosted stands for an application with a server process exposing the application itself. Like Kestrel for Blazor.
IIS is not the discriminant for hosted or self-hosted, is just the base of the concept.
From my point of view when I use IIS Express integrated in Visual Studio debug, the application is self hosted and hosted at the same time.
Is hosted in IIS Express from a web server perspective and, at the same time, is self hosted from a service perspective.
Just for information: the applicationName.exe produced by the compiler for Blazor app is just a launcher based on Kestrel. Is a web server that launch the applicationname.dll
An example below from two total different application. The executable (you can open it with a binary editor) is the same.

Lazy loading content web app in amazon EC2

I'll give a context of what happened to understand better. I used Azure services app to keep my application running, but I created a new datacenter on amazon and migrated my web app to the new server.
I use the iis in it to store the application. It's in asp.net and first there was a slow issue with me. bundles, but with this new migration I saw that was too slow to load them, in azure app services took about 200ms, already on the new server was for 3 seconds each bundle on screen, I solved this problem just pointed the way of scripts without using bundle.
The way I did it was a palliative solution and I didn't solve the root of the problem, the loading time on the screens is still a bit time consuming and is spoiling the user experience.
In azure the same application in their service app does not take so long, already on the server running on iis is taking too long and I think it is some configuration but I was not successful.
This is the application in azure:
azure
This is the application in amazon:
amazon
This both examples is the same app, same database and same user account. I believe the problem is not in the application but in the server config.
Someone can help me about that?

How to host multiple WebSites on same IP and Port in IIS 7?

I'm working asp.net web based application, I have deployed this application on server, Its getting response on port 80 from a outside client. I want the to fix the bugs so I want to run this application in Debug mode so that I can attach the worker process with the application and this is making the Performance down and its disturbing the QA team. So can I have two application one can run in release mode so that QA activity does not get disturbed and parallelly I can debug the build and fix the bugs or can do further development. I'm facing the same problem during the development activity, If multiple developers are working paralley , only one is able to debug the application other one has to wait. So please suggest me, If I can get rid of this situation.
I have only one server on which I can test this application.
So My requirement is how to host multiple websites on single ip and port.

How to restart an ASP.Net Application automatically when it goes down

I have developed a asp.net application which is deployed on his personal server. The application is running in the background and updating his e-commerce database automatically. I have used Quartz.net for scheduling purpose.
My problem is that the application gets stopped after certain period (3-8 hours) of time.
I want a way to restart the application automatically as soon as it goes down.OR alternatively a service which visit the application periodically so it goes live.
Note: I have access to my client server and can yous windows scheduling if there is any solution relatively.
I have also read similar post but had no luck.
Your prompt response will be highly appreciated.
Thanks

service discovery during "Add Service Reference"

i'm building an Asp.Net app (contains the service) with Silverlight control (need to use the service) and having a problem after i discover the service and press OK button, can anyone help me please?
Try/Check the following:
Your service project is being properly build with no errors.
There is no other IIS / IIS express servers running in background.
Try to open the service address that you are trying to consume in the browser and see if it is loaded OK.
This should give you a lead on the problem.

Resources