I hope you can help me out here, because i tried to get some answers already in another board (see here) This Question is build on a reply of Scott Forsyth here.

When adding a new virtual directory to the 'default web site' in IIS Manager, all the other Applications located in the default web site are recycled somehow. In order to simplify my problem, i took an example where i could track a timestamp from an current session and realized that the session information is really getting lost after adding a VD, meaning the AppDomain was recycled.

This is the situation:


Default Web Site

    1 (virtual directory) (d:\TestAppDomains\1\)

       - app1 (Application)           (using App Pool 1)

    2 (virtual directory) (d:\TestAppDomains\2\)

       - app2 (Application)           (using App Pool 2) 

As far as i understood adding a virtual directory is just making changes to the applicationHost.config, which should not cause the AppDomains to recycle. Maybe it is a delegation issue, but i guess i dont get it enough to understand :(

Are there any properties which affect this behaviour? I´ve already set the AppPool settings to not recylcing after a configuration change, but it didnt help.

I would REALLY appreciate if you could help me out with this one, because i am struggling with it for almost 6 months now.

Of course i´ll gladly provide more information if you need them.

Update 1:

The HealthMonitoring cannot help me out on this one for two reasons:

  1. Cannot find any entry for AppPool recycle, where should it be? Event Viewer -> Windows Logs / Application and Services Logs? (Should be configured properly)
  2. Maybe i got something wrong. First i thought it is an app-pool recycle but with the simplified test i build an example without any applications and additional app-pools. Now it just looks like this:


Default Web Site

    1 (virtual directory) (d:\TestAppDomains\1\)          
           session1.aspx (Sets current timestamp to session variable and redirects to session2.aspx)
           session2.aspx (displays session variable)

By calling the localhost/1/sessions1.aspx i can see the timestamp. After adding a second virtual directory (e.g. "2" (d:\TestAppDomains\2)) and refreshing the page the session is gone, meaning the variable is null.

Cheers, Adam

  • Perhaps you should distinguish between your application pool recycling and your application domain restarting. – Greg Askew Mar 21 '12 at 15:27

I had the same situation as you described at IIS forum: one web site, several application pools, several pairs of Applications (web-service) and Virtual directories (html + js), automated deployment and so on.

The problem was the same: when I added/removed virtual directory, all applications restarted. This was not good as I planned to serve multiple versions and wanted users to work while fresh version was deployed.

I've played with settings delegation with no success. Then I noticed that adding/removing of one Application didn't led to the restart of others.

So, this was the solution: create for web pages separate Application instead of Virtual directory.


If you have an ASP.NET application domain restarting, the reasons are covered thoroughly here:


Do you have application pool recycling event logging enabled? That would be the first place I would start:

enter image description here

If you have an ASP.NET application, you can also enable HealthMonitoring in the system.web section of web.config. These logging options may be helpful in identifying what is occurring. A sample:

    <healthMonitoring enabled="true" heartbeatInterval="1">    
        <add name="HeartBeat" 
        <add name="App Lifetime"
             eventName="Application Lifetime Events"

FAQ - Health Monitoring in ASP.NET 2.0

healthMonitoring Element (ASP.NET Settings Schema)

  • Thanks Greg, i have updated my initial question for more information. – Adam P. Mar 21 '12 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.