Mostrar un mensaje de "carga" en Application_Start()

I have an MVC3 application that takes 30+ seconds for global.asax Application_Start() to execute. When a user hits the site for the first time after the App Pool was reset, the browser just sits there with a "waiting for website..." message.

Is there a way to show a "Loading data..." message/page to let the user know that everything is OK and to be patient?

preguntado el 28 de agosto de 12 a las 13:08

3 Respuestas

No, there's no way to show any messages from Application_Start. IIS 7.5 has a cool Función de inicio automático which allows you to preload your application in memory and thus avoid the long waiting. Another possibility is to have some external service that queries your site at regular intervals so that it doesn't get unloaded by IIS.

If you cannot use this feature, then you will have to reduce/optimize the amount of work you do in your Application_Start so that it doesn't take 30 seconds.

Respondido 28 ago 12, 13:08

Not within the same .net application - you can't show anything from within Application_Start. You could create another small app as a landing page which polls for a response from your main app and then redirects once it gets one.

But a better solution would be to move some work out of Application_Start - can't you let the user arrive at your first page and then call an initialization method once they have landed?

Respondido 28 ago 12, 13:08

You can't do that in that particularly way, as there is no response from the server, and for such, you can't do anything.

But how about to implement a latido del corazón that will query any URL of your application avoiding it not to enter in stand mode?


an idea: Set an external service to query your application every 5 minutes:

RestSharp solicita en la api restful de momentapp

contestado el 23 de mayo de 17 a las 12:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.