I’m building an asp.net MVC 2 application that has a ping page to let another system know if the application is up and running. I believe this is also used to keep the load balancer aware of active nodes. Here’s what I have in my controller’s action.
public ActionResult PingApp()
{
// If we get here this node is alive. Echo "Ok".
return Content("OK");
}
I do not believe it is working correctly because when I start or restart the application there a lot of other tasks that need to be set up before the app is truly ready and “OK”. (ie, loading dll’s, precompiling aspx pages etc.. if I understand things correctly). I’m using IIS 7. Does anyone know how I might check and see if IIS and My application is truly “ready”.
– Thanks.
Asp.net MVC is a Web Application and not a Web Site (differences in this stackoverflow question), whitch pre-compiles on a per-page basis. Asp.net MVC when running its DLL is completely JIT-compiled to the platform and is running.
So if your page is part of the same assembly, all others should be running just as well. If other pages need functionality of other assemblies, then they’re loaded on demand.
Load all assemblies
If you’d like your
PingAppto load those as well, you should be calling some dummy functionality inside of them so they will get JIT-compiled, loaded and executed.The first call to your
PingAppwill take some time to actuall JIT compile and load your web application and run it.