Home > Mobile >  How to invoke WebApi only if IIS Website is running / not idle
How to invoke WebApi only if IIS Website is running / not idle

Time:01-17

IIS Website stops the working process when there are no new requests for some time.

I would like to Invoke WebApi using a http call if the worker process is running. I don't want to wake up sleeping bunny.

This will be part of my DevOps realease pipeline. Before I release a new version and shut own old I want to notify online users. Obviously, if the app is sleeping, there are no online users.

CodePudding user response:

You can use Get-IISAppPool to check if the app pool has any worker processes:

if ((Get-IISAppPool DefaultAppPool).WorkerProcesses.Count -gt 0) {
    # do something
}

Change DefaultAppPool to the real name of your app pool.

  •  Tags:  
  • Related