Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

Sites

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:

Sites

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

share|improve this question
    
Perhaps you should distinguish between your application pool recycling and your application domain restarting. –  Greg Askew Mar 21 '12 at 15:27
add comment

2 Answers

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.

share|improve this answer
add comment

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

https://blogs.msdn.com/b/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.asp

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:

  <system.web>
    <healthMonitoring enabled="true" heartbeatInterval="1">    
      <rules>
        <add name="HeartBeat" 
             eventName="Heartbeats" 
             provider="EventLogProvider" 
             profile="Default" 
             minInstances="1"
             minInterval="00:01:00"
             maxLimit="Infinite"/>
        <add name="App Lifetime"
             eventName="Application Lifetime Events"
             provider="EventLogProvider"
             profile="Default"
             minInstances="1" 
             minInterval="00:00:00"
             maxLimit="Infinite"/>
      </rules>
    </healthMonitoring>

FAQ - Health Monitoring in ASP.NET 2.0
http://forums.asp.net/t/1027461.aspx/1

healthMonitoring Element (ASP.NET Settings Schema)
http://msdn.microsoft.com/en-us/library/2fwh2ss9%28v=vs.100%29.aspx

share|improve this answer
    
Thanks Greg, i have updated my initial question for more information. –  Adam P. Mar 21 '12 at 15:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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