Our MVC site is using WIF to authenticate users to ADFS, but the warmup action that I am trying to call is unprotected and does allow anonymous users to access it. However, the warmup action is never called by the application initialization process. Is there a specific reason why this would be?
Application Initialization with WIF
Is this a detructive on non-destructive process?
Recently I found myself in a quandary. I have worked on IIS in all its variations now for over 15 years. I will never claim I know it all (a certain means of learning humility), but I have developed a pretty good knowledge-base. Nevertheless, I have come to question my personal assessment. Here is the dichotomy:
I have always preached that an application pool recycle is a non-destructive process. When you recycle, the old pool stops accepting new threads and a new app pool is spun up to accept new threads. The crux is, I have always believed that the old pool gracefully shuts down and does not hard kill the remaining threads. Today I was challenged on that point and had someone from Microsoft quoted as specifically stating that unless the threads dissipate quickly, they will be hard killed, that there is no graceful shutdown.
While things went far afield from there, this is a pivotal issue. Is a recycle of any app pool destructive or non-destructive? If the threads in the old pool face a hard kill, the process is destructive. If there is no graceful shutdown, then destructive!
I always thought this was the edge IIS had over J2EE. Can someone settle this?
Thanks,
initializationPage not working correctly IIS 7.5
<site name="mysite1.example.com" id="3"><application path="/" applicationPool="mysite1.example.com" preloadEnabled="true"><virtualDirectory path="/" physicalPath="C:\Websites\MySite1.Demo" /></application><bindings><binding protocol="http" bindingInformation="*:80:mysite1.example.com" /></bindings></site>With the application pools set up as follows
<add name="mysite1.example.com" startMode="AlwaysRunning" managedPipelineMode="Integrated" managedRuntimeVersion="v4.0" />On only one of these sites I have set up an initializationPage calling an MVC3 controller action in the web.config.
<applicationInitialization remapManagedRequestsTo="Startup.htm" skipManagedModules="true" ><add initializationPage="/Application/Initialise/" /></applicationInitialization>On that site I have put logging in for the Application_Start, Application_End and Initialise code. I am finding that setting the startMode="AlwaysRunning" means that after the app pool is recycled the application starts up again but the Initialise code never gets called at this point. Instead it only gets called on the first time I make a request to the site from a web browser. Strangely I do see that on at least one of the other sites which I have **not** set anything up in the web.config for it is doing some warm up! That site (still in development) happens to have code to send an email when accessed. And I can see periodic emails come through with HTTP_USER_AGENT:IIS Application Initialization Preload. Nothing is recorded in the IIS logs for that site / user agent however so I am unsure if similar warm up is being carried out for any of the other sites. Are there known issues with running this on multiple web sites? Is there any way of configuring any logging on it so I can try and see what the problem is exactly?
Application Initialization module not requesting initialization page
Hi,
We have a Windows 2012 Standard server that we use to test some of our applications.
We have used Application Initialization to keep the our applications available and use the splash screen as its only a few of us testing.
However I now have a requirement to load some css and script bundles at startup time and want to use the initializationpage parameter in AI to do this but it does not appear to be working.
When I restart the app I get the splash screen when trying to access the app but the page defined in AI does not appear to be called.
After trying various different things I decided to just use a simple app to test if the issue was with our app or AI as we have SSL and URL rewrite in use too. I have a similar app to the one used in this AI setup tutorial - appinit
I I have just made a separate page that copies a file and writes to the log as the initializationpage and the app simply waits 20 seconds before is shows an image, very simple. There is not SSL nor URL rewrites involved with this. In fact its the only app we have defined on the server atm.
So when I start the app the splash screen shows until the times expires when it shows the image, as expected. However there are no log messages nor a new file created.
I ran the initialization page after this and messages and new file appear, so there are no issues with that page itself.
I have been through many articles etc about this and I think I have all the correct settings etc, listed below.
Does anyone have any ideas on what might be wrong or what I may have missed ?
Thanks, George.
OS : Windows 2012 Standard
IIS 8.0.9200.16384
ApplicationInitializationModule installed
Web.config
<applicationInitialization remapManagedRequestsTo="splash.html" skipManagedModules="true" doAppInitAfterRestart="true" >
<add initializationPage="WriteToLogPage.aspx" />
</applicationInitialization>
ApplicationHost.config
<applicationPools>
<add name="appinit" autoStart="true" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" />
<applicationPoolDefaults managedRuntimeVersion="v4.0">
<processModel identityType="ApplicationPoolIdentity" />
</applicationPoolDefaults>
</applicationPools>
<site name="Default Web Site" id="1">
<application path="/appinit" applicationPool="appinit" preloadEnabled="true">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\appinit" />
</application>
</site>
<globalModules>
<add name="ApplicationInitializationModule" image="%windir%\System32\inetsrv\warmup.dll" />
</globalModules>
Application Initialization with login page
Hi,
I have issue with application initialization of one of my sites. Everything was fine until our development team implemented login page. Now warm up module works just for that page but after entering login credentials, it takes long time to upload original site. Is there a way of overcoming this issue and if there is what steps I need to take. I am bit new at IIS this so please help.
Thanks in advance
Can I re-distribute this Module with my Application
Hi,
This module (IIS 7.5 Application Initialization Module) is a pre-requisite for our product on Windows 7 OS.
Can I re-distribute this module set-up exe as part of our Product set-up exe?
Response/help will be much appreciated.
Thanks,
Deven
MVC 4 View as initializationPage not working
Hi,
I'm using the IIS 7.5 extension. It works fine, except if it is set to request an MVC view.
I have temporarily updated global.asax to make it write http requests to a log file so I can see requests that are being made during warm-up. I can see that the requests are being made with User Agent: IIS Application Initialization Warmup from IP: 127.0.0.1. (The requests do not show in the IIS http log.)
This works - /Folder/page.cshtml gets requested:
<applicationInitialization remapManagedRequestsTo="startup.htm" skipManagedModules="true" doAppInitAfterRestart="true"><add initializationPage="/Folder/page.cshtml" hostName="mydomain.com" /></applicationInitialization>
This does not work- /MVC4App/Warmup does not get requested:
<applicationInitialization remapManagedRequestsTo="startup.htm" skipManagedModules="true" doAppInitAfterRestart="true"><add initializationPage="/MVC4App/Warmup" hostName="mydomain.com" /></applicationInitialization>
I'm not using SSL or authentication, and the mvc view can be requested by an anonymous user.
Can anyone tell me how to make this work, or how to debug it?
Thanks!
IIS preload process is targeted for all applications when adding/removing an application
I'm using IIS 8.0 which is hosting multiple application (like 15) all location under the Default Web Site. Each application has his own pool.
To have better performance during the first website access, I enabled the "Application Initialization" on all the applications (setting the preload, AutoStart, ServiceAutoStartProvider, AlwaysRunning, ...).
I changed those settings with the Configuration Editor of IIS manager. All those settings are set by default when I create a new site/pool. I just have to set a specific recycle time during the night (and different for each application).
Everything is working fine (each application is recycled and then the preload is started at a different time during the night).
The problem is that when I add or remove a website, the preload is started on all my applications which result in a high CPU usage. I don't understand why. I'm wondering if it's not due to the fact that when we add/remove an application, the ApplicationHost file is edited and so the config reloaded (which cause the preload process to be started on all applications).
Do you know how to avoid that?
question: Is initializationPage value limited to calling localhost only?
Has anyone else noticed that with the App Init feature, the InitializationPage URL is only ever called on localhost? You can't change it to list any other domain or host-header. It always creates the URL ashttp://localhost plus whatever is in the initpage value.
That's just really debilitating if you need the feature to call a page in some other site within the IIS server.
For more details, see a forum thread I had opened last week with the same question above (but a slightly different subject). I realized only tonight that that there was this forum specific to the App Init feature. That forum thread is:
And this other question from another writer late last year (in this forum) seems to be reflecting the same problem, though worded differently:http://forums.iis.net/t/1193175.aspx/1?Host+Header+Web+Sites
Anyone with thoughts? I fear that no one's noticed this problem because most just have been testing/demo'ing the feature, and using localhost was good enough. Add to it the fact that some would have a hard time ever noticing what URL is generated, and it's all the more apparent to my why few have complained of this--and that perhaps many complaining "it doesn't work" are just suffering from this very problem.
IIS 8.5 on Win Server 2012R2 Application Intialization URl is not tracked in IIS logs
Hello,
I successfully configured application intialization on IIS 8.5 and it works (use url "/startup/appinit")
But I cannot find this URL in IIS logs that are per server and include all requests for all sites on the Web Server.
Does the IIS trigger app init URL without using the HTTP.SYS driver that prevents url to be tracked in IIS logs or this is lack of the app initialialization configuration?
I looked through the articles
https://www.iis.net/configreference/system.webserver/applicationinitialization
and
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
but not found any information regarding disabled logging of application initalization page.
UPD:
Found the article
https://blogs.msdn.microsoft.com/vijaysk/2012/10/11/iis-8-whats-new-website-settings/
When you set preloadEnabled to true, IIS will simulate a user request to the default page (can be changed with initializationPagemetabase setting) of the website/virdir so that the application initializes.
The request is not logged in the IIS logs.
But you can trace this with FREB. Every time you restart your application pool you will see a FREB trace file for the dummy request. You can identify this request by analysing the GENERAL_REQUEST_HEADERS and looking at the User-Agent string.
User-Agent: IIS Application Initialization Preload
How to stop the startup page and redirect to other static page
Here is the startup page configurations:
<system.webServer><applicationInitialization remapManagedRequestsTo="startup.html" skipManagedModules="true" doAppInitAfterRestart="true"><remove initializationPage="/"/><add initializationPage="/"/></applicationInitialization></system.webServer>
I want to check the some settings before the application started, if there are settings missing, then throw the exceptions out and redirect to the error page. but if I enable the applicationInitialization, I can't stop the startup page , then return the error page.
Anyone can help me solve the problem? Thanks.
Rogan
Application Initialization not working for ports other that 80
Hi
We have used “Application Initialization” concept of IIS for one of our project that hosts WCF services
https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
This solution works for applications hosted on IIS port 80 .
But there is no documentation to make it work for applications hosted on ports other than 80.Please note that all our services are hosted on 8080 and this solution doesn't work.Is there any work around for this.
Appreciate for your help or guidence
Regards
SUnil
IIS Application Pool Initialization - Warming up a login request...Is it possible?
Hi,
I'm working on a web app which is experiencing slow first hit performance whenever the app pools are recycled. Subsequent requests are always pretty quick, but that first 'cold' run is considerably slower.
I've deployed the app pool initialization plugin to warm up the site, which seems to have done the trick in terms of actually loading the login page quickly, there is a but.
When users attempt to login, the first request is always slow (even with the initialization in place), which defeats the object of warming up the application.
Is there any way to improve this first hit of the login request? Is there something I can do to schedule/automate an initial login request before users will come to login?
Thanks in advance.
IIS 10 Automatic Application Initialization system.webServer/applicationInitialization
I am trying to set up automatic application initialization on IIS 10 on win server 2016 and under sectionsystem.webServer/applicationInitialization I have set doAppInitAfterRestart to True. I have also manually included a static list of aspx files I want to have preloaded.
This works well. It preloads the site after an IIS reset or pool recycle.
However I am just wondering if instead of having to specify every single aspx file to prehit
e.g.
<system.webServer>
<applicationInitialization skipManagedModules="false" doAppInitAfterRestart="true">
<add initializationPage="/example1.aspx" hostName="localhost" />
<add initializationPage="/example2.aspx" hostName="localhost" />
<add initializationPage="/example3.aspx" hostName="localhost" />
<add initializationPage="/example4.aspx" hostName="localhost" />
</applicationInitialization>
Am I able to instead get the whole Web App directory to get automatically scanned and preload the whole web app?
for example something like
<system.webServer>
<applicationInitialization skipManagedModules="false" doAppInitAfterRestart="true">
<add initializationWebApp="/exampleWebApp/*.aspx" hostName="localhost" />
</applicationInitialization>
This would be awesome because aspx files in our site often get changed, added or deleted, I can't find any detailed documentation on this whole process so any assistance would be incredibly appreciated.
thanks again
How to powershell script the IIS warm-up for asp.net 4.0 ?
Hi there,
Can anybody please tell me how to powershell script the IIS to use the asp.net 4.0 warm-up mechanism?
I've created this powershell script, but it doesn't seem to write anything into the applicationHost.config file:
( trying to implement step 3 from here, but using Powershell: http://weblogs.asp.net/gunnarpeipman/archive/2010/01/31/asp-net-4-0-how-to-use-application-warm-up-class.aspx )
Import-Module WebAdministration
$SiteName="Default Web Site"
$ApplicationName=“WebOne“
Add-WebConfiguration "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='WebOne']" -Value @{serviceAutoStartEnabled="true";serviceAutoStartProvider="PreWarmMyCache"} -PSPath IIS:\Sites\$SiteName\$ApplicationName -Location $SiteName/$ApplicationName
I'm trying to add these two(2) properties ( serviceAutoStartEnabled="true" andserviceAutoStartProvider="PreWarmMyCache"):
e.g.:
<applicationpath="/"serviceAutoStartEnabled="true"serviceAutoStartProvider="PreWarmMyCache"/>:
To my current Application Path:
<sites>
<site name="Default Web Site" id="1">
<application path="/WebOne" applicationPool="ASP.NET v4.0">
<virtualDirectory path="/" physicalPath="C:\NetProjects\WebOne" />
</application>
</site>
</sites>
I will also need to powershell script this:
( step 4 from here, but using Powershell: http://weblogs.asp.net/gunnarpeipman/archive/2010/01/31/asp-net-4-0-how-to-use-application-warm-up-class.aspx )
<serviceAutoStartProviders>
<addname="PreWarmMyCache"type="PreWarmCache, MyAssembly" />
</serviceAutoStartProviders>
Any help would be greatly appriciated.-
I've already powershell scripted this stuff below which is also needed, but I need the stuff above (serviceAutoStartEnabled="true" andserviceAutoStartProvider="PreWarmMyCache" ), which I mentioned.-
#Load IIS Modules
Import-Module WebAdministration
if (Test-Path IIS:\AppPools\SosSWarmUpWorkerProcess)
{
#Let's delete the entry if it's already there ( while deploying between versions )
Remove-Item IIS:\AppPools\SosSWarmUpWorkerProcess -Force -Recurse
}
$myNewPool = New-Item IIS:\AppPools\SosSWarmUpWorkerProcess
$myNewPool.managedRuntimeVersion = "4.0"
$myNewPool.startMode="AlwaysRunning"
$myNewPool | Set-Item
Application Initialization Warmup period
Hello there,
We have two IIS 7.5 web applications with below settings (2 different app pools),
1. Application 1 - Idletimeout = 0
2. Application 2 - Idletimeout = 20 (default value) - Application Initialization configured for this site.
Question 1
When we analyzed the performance of the both the sites, Application 1 is responding faster than Application 2 (After the new worker process generated due to idleness)
Question 2
For application 2, the new worker process gets generated after few minutes when the site is idle. What does this few minutes/ warm up period refer to? Where it can be configured?
Question 3
Assume like I have configured 'Application Initialization' for Application 1 as well (along with Idletimeout = 0)
Now if I recycle the app pool manually and assume no requests have reached the server yet, then will the Application Initialization sends the request after the warm up period?
Thanks,
V.Vetrivelmurugan
Help in warm up model
I'm using iis 8 and try auto-start in an ASP application.
The warmup is calling on the route specified in web.conf when start. so i think the configuration is right.
(https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-application-initialization)
However the user login problem occurs, when i try execute the method that get values on Data base tablet.get (), the method check current user session and cookies. but, login action not comen from http requisition.
I to call the method login inside the application.
I can't call http requisition because i want warmup before the application be behind loud balancing.
Do you have any suggestions for this case?
I noticed in some posts that warmup does not work with login. is it right?
I tried using Preload with "System.Web.Hosting.IProcessHostPreloadClient" and came across the problem of session and cookies.
Why does IIS Express Restart my App Pool in MVC Application
I have a fairly complex MVC Application which must initialize when the Application starts. I am trying to diagnose why the App pool is restarting after the first MVC page is rendered. To diagnose this issue, I put break points on Application_Start and Application_End. Applicaiton_Start is called as expected. At the end of the first returned HTML/Razor page from my application, Application_End is called. On the next page request, Application_Start get called again, and then seems to run as expected without restarting.
I thought this was caused by Razor compiling the views at runtime, which would then updating the BIN foldee. I know that IIS and IIS Express restart the APP pool when the BIN folder is updated, so I assumed this MVC Razor compllation was causing the IIS process to restart the app pool. To mitigate this, I followed the instructions here: https://chrismckee.co.uk/asp-net-mvc-compiled-views/ to pre-compile my Razor views. I know that the vies are now pre-compiled, as this did locate several compile issues [compile errors] that would not have been found until runtime without these configuration changes resulting in the pre-complication of the Razor views.
So the question is this:
1) How Can I diagnose why the app pool is restarting?
2) Does anyone know why this happens in and MVC application running in IISExpress?
[... and obviously, how to prevent it from happening]
Thanks
jloper
preLoad firing after "on idle" recycle, but not after web.config change
I recently set up the Application Initialization module on IIS 7.5 on a Windows Server 2008 R2 machine with ASP.NET 4.0 running an MVC 3 web application. It appeared to work like a charm. If I spin up IIS, I immediately see the web application spin up whose applicationPool was set to startMode="AlwaysRunning" and site had preLoad="true" in my applicationHost.config. I then set my "Idle timeout" to a low number, and happy saw that time arrive and my application immediately spun back up again. So, everything seemed to be working great. FYI, I didn't have to bother setting up anything in my web.config to indicate where the preLoad request should be directly, nor did I bother with providing a resource that would render during preLoad/warmup.
However, when I make a change to the web.config by hand, the AppDomain appears to unload as expected, however the preLoad event doesn't appear to trigger again. Hence my web application appears dead in the water until it receives a browser initiated http request. The same seems to be true when I push a new deployment over an existing deployment using a remote MS Deploy. I'm guessing that is effectively the same as a manual update to the web.config, but also typically deploys new dlls which I imagine would have a comparable behavior, but I haven't yet tried that case as well.
So, I'm wondering if anyone has explicitly seen preLoad firing after a manual modification to the web.config, in which case I'll start trying to figure out what configuration I may have wrong. Or is this a short coming of the IIS module? Or am I misunderstanding how it is expected to work?
Thanks.
Pete
WarmUp Module installation broke IIS
HI,
We are in the progress of installing the "Application Initialization" module on our Win2008 r2 standard server and on one of them as soon as we active the application pool startmode the application pools automatically crashes. Since I can't find anything on the internet I was wondering if anyone in here ever had this problem. The only way to make my iis server work again is to uninstall the module.. repairing it didn't do anything neither.
Event viewer logs :
1) A process serving application pool 'XXXXXX' terminated unexpectedly. The process id was '4060'. The process exit code was '0xc0000005'.
2) Application pool 'XXXXXX' is being automatically disabled due to a series of failures in the process(es) serving that application pool.
3)
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: MSVCR80.dll, version: 8.0.50727.6195, time stamp: 0x4dcdd833
Exception code: 0xc0000005
Fault offset: 0x000000000002f6c0
Faulting process id: 0xfdc
Faulting application start time: 0x01cff9b84b6dc2ba
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_88e41e092fab0294\MSVCR80.dll
Report Id: 8bbc3f46-65ab-11e4-8b5e-0050568a33e5