0

I have a MVC API Application and its hosted on my local machine IIS(8.0), In that application I am feeding some other api with the real time data, All works fine until the system is not restarted(or app pool is not restarted/recycled). Is there any way through which I can call my global.asax Application _start event just after the system is restarted.

Note: I don't want to use a window service.

Code Snippets of Global.asax :

 protected void Application_Start()
    {
       DadBal dad = new DadBal();
        dad.WriteLogs("App-Started" + DateTime.Now.ToString(), "AppInit");


    }
nik_boyz
  • 165
  • 3
  • 15
  • Isn't your application under IIS? It should start automatically. – SᴇM Oct 09 '18 at 10:51
  • It is, but it will not get started until or unless i make a request on the browser. – nik_boyz Oct 09 '18 at 11:03
  • So why you want to start it if no one will make request? – SᴇM Oct 09 '18 at 11:07
  • because its kind of an internal process, with help of sql dependency it raises events to update some other api's. – nik_boyz Oct 09 '18 at 11:09
  • try this https://www.red-gate.com/simple-talk/blogs/speeding-up-your-application-with-the-iis-auto-start-feature/ – Arunprasanth K V Oct 09 '18 at 11:14
  • Would it be an option to restructure the application, so that the events are raised by a separate process, so that the MVC application only needs to start when the first request is being made? – Bas Oct 09 '18 at 11:34
  • 1
    Also, why don't you want to use a service? Because this seems like a perfect use case for a service. – Bas Oct 09 '18 at 11:34
  • @Bas 1. No it can not be re-structured as it is existing application 2.It can not be used as a service as this api is being used by the power bi dashboard so calling a web service from a dashboard is not possible. – nik_boyz Oct 09 '18 at 15:47
  • @ArunprasanthKV : it is for server not for the local iis – nik_boyz Oct 10 '18 at 03:50

0 Answers0