Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically set IIS preloadEnabled

Tags:

c#

iis-8

Is it possible to set preloadEnabled="true" for Application Initialization? The schema for Application in ServerManager doesn't seem to recognize the attribute, so when I set the following, no changes occur.

ServerManager serverManager = new ServerManager();
application = serverManager.Sites[0].Applications[0];
application.SetAttributeValue["preloadEnabled"] = "true";
serverManager.CommitChanges();

Is it possible to do this through ServerManager, or another way?

Some context: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization

like image 334
Jake Avatar asked Dec 31 '25 17:12

Jake


2 Answers

Two things fixed this for me.

1) Using a boolean instead of a string

application.SetAttributeValue["preloadEnabled"] = true;

2) Installing the Application Initialization first.

like image 107
Jake Avatar answered Jan 05 '26 00:01

Jake


See this post

As you mentioned, you need to install the module first because by default it is not installed for IIS8. You can do this with a starup task as outlined in Sandrino Di Mattia's answer and blog post (see link).

like image 45
Paul Hiles Avatar answered Jan 05 '26 02:01

Paul Hiles



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!