Is Application_Start of Global.asax is called by iis on wcf application when the iis is the host ?

10,352

Solution 1

If the WCF Service is hosted on the IIS on a website, then the Application_Start Method should be called. However, by default application pool wouldn't start until the Application Pool receive the first request.

So, until you make a call to WCF Service, the Application_Start method wouldn't be called.

Also, IIS offer Application Initialization Module, which can be used to issue a Fake Request to the website by the IIS Server so that Application can start Automatically once the IIS Starts. It also allows for custom warm-up code for the Application. You can read more detail here.

Solution 2

WCF doesn't work like that. It's a per-call service and as so handling requests on demand...

A little more details can be found here: https://stackoverflow.com/a/739674/444665

However you might be able to solve your wish through this solution Running a function on WCF start up

Share:
10,352
Yanshof
Author by

Yanshof

Updated on July 01, 2022

Comments

  • Yanshof
    Yanshof over 1 year

    I have wcf application that is hosted by iis. I add the Global.asax file with implimentation of the Application_Start.

    But when i start the iis ( or reset ) i don't see that the Application_Start method is called.

    How to fix it ? I want that the iis will call this method on iis start (when the computer startup ( because the iis start automatic on machine start ) or when iis restart )