
When working with “9 to 5” web applications you deal with idle time periods where the users submit few or no requests to specific services of your application. Thanks to IIS 8 it is very simple to “warm up” your WCF Services and to be sure that your services will be available through Azure Bus relay after an IIS (re)start. Also there is no more need to use AppFabric only for this feature.How to keep the IIS Application Pools always awake In this code snippet below, “BeerService.svc” is my service to be initialized. The final step is to edit your Web.Config and add the “applicationInitialization” element. Set the Preload Enabled setting of the Web Application to True. Set the Start Mode of the Application Pool your WCF Service is running under to AlwaysRunning. Step 1 – Add the Application Initialization RoleĪdd the Application Initialization Role under Web Server (IIS) => Web Server => Application Development Step 2 – Configure the Application Pool With IIS 8 we can use the built-in Application Initialization to “warm up” our WCF Services when IIS starts. This requirement means that when hosted on IIS, such WCF services must be explicitly initialized, or they require alternate mechanisms to automatically initialize the application. Therefore, the usual IIS/WAS message-based activation does not work for WCF services with Service Bus bindings, because these bindings must first establish an outgoing connection to the service in order to receive messages. This binding also has to initiate an outbound connection to Service Bus in the cloud, and authenticate itself before the message pump is activated.īecause IIS and the Windows Activation Service (WAS) rely on message-based activation, by default the web applications hosted in IIS/WAS are initialized only after the first request comes in. Similarly, a “messaging” binding provides an automatic messaging pump that pulls messages from a queue or a subscription, and is integrated into the WCF ReceiveContext mechanism. The relay service sends messages to the on-premises service through the bidirectional socket already in place. It connects to Service Bus, authenticates itself, and starts listening to messages before the client sends its requests. However, for the on-premises WCF service with a Service Bus relay binding to start receiving messages from Service Bus in the cloud, the on-premises service has to open an outbound port and create a bidirectional socket for communication. MSDN explains why:īy default, IIS initializes a web application when the first request is received. The main challenge with this setup is related to IIS aplication activation. A common scenario of using Azure Service Bus relay is when you what to expose an on-premise WCF service to a cloud application or business partner without changing your existing firewall configuration.
