Is it possible I can use PowerShell command (e,g, New-WebSite) to create a web site and set site's preloadEnabled="true"?
In the left pane of IIS Manager, navigate to the SQL Monitor web site. Right click the application node and select Manage Website > Advanced Settings. Set Preload Enabled to True. Restart IIS by executing iisreset in a command prompt running as an administrator.
Setting preloadEnabled to "true" tells IIS 8.0 that it sends a "fake" request to the application when the associated application pool starts up. That is why in the previous step we set the application pool's startMode to "AlwaysRunning".
IIS Application Initialization allows website administrators to configure a web application to be pre-loaded as soon as the worker process starts, before the first request arrives. By pre-loading the application, the worker process is able to reduce the time it takes to respond to the first request.
If you manage Windows Servers, you've likely worked with Internet Information Services (IIS). Websites are one of IIS's main features and, using PowerShell, you can easily manage and automate IIS with PowerShell IIS scripts! In this article, you'll be introduced to a new way to manage IIS using PowerShell.
This is a bit late, but this will help others... This worked for me and was a little less verbose. The key difference is that I removed ApplicationDefaults because I am setting the application, not the defaults here:
Set-ItemProperty IIS:\Sites\<siteName>\<applicationName> -name preloadEnabled -value True
WHERE: 'SiteName' might equal Default Web Site 'ApplicationName' might equal MyApplication
This should do the trick. You can use the get-itemproperty
to verify that it worked. It took me a while to figure out where to find preloadEnabled
within powershell but if you pipe the site path to get-member
, then you can work your way from there.
import-module webadministration
set-itemproperty IIS:\Sites\SiteName -name applicationDefaults.preloadEnabled -value True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With