Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Web Application app startup workflow for IIS

Okay, so let's say I have a web application that absolutely has to perform some kind of startup and has to remain running indefinitely regardless of the communication it receives from the clients (as it's a push based system)

Now for testing I have been hosting this as a windows service, which is great because it allows for me to have a hard entry point to the application where I can do my bootstrapping and get the service up and running

Next, I'm trying to move this into the IIS world instead so I can face this service to the outside world...and I've hit a snag...I don't have any hard entry point where I can bootstrap the application except for global.asax, which as I understand it is only invoked when the clients make a call to the server

Is there a better area I can put an entrance to the application and get it bootstrapped without waiting for a client to connect to it? And is this area only called once or is it going to be called periodically as the application falls out of scope (so to speak)? Like I said, the app has to remain running at all times

like image 503
Robert Petz Avatar asked Oct 05 '22 05:10

Robert Petz


1 Answers

Is there a better area I can put an entrance to the application and get it bootstrapped without waiting for a client to connect to it?

Yes, there is. You can warm up IIS.

And is this area only called once or is it going to be called periodically as the application falls out of scope (so to speak)?

It depends which method in Global.asax you use. Application_Start runs once per app start.

Like I said, the app has to remain running at all times

Beware, dragons here. This depends how critical it is. If you need utter reliability, you must use load balancer and have at least one other duplicate service. Other things to consider, app pool needs to be recycled from time to time. IIS, OS, your application have bugs, updates needs to be installed, network device fails, power outages do happen and so on.

like image 164
oleksii Avatar answered Oct 13 '22 11:10

oleksii