<< Click to Display Table of Contents >> Configurando Servidor IIS |
![]() ![]() ![]() |
Informação
Session infelizmente morre depois de 20min. Ou seja você configura:
Session["Variavel"] = "Teste".
Se você deixar a página 20 minutos sem mexer, esse "variavel" será null. Simplemente o servidor "limpa" os sessions.
Existem outros motivos pelo qual o sessions simplesmente é zerado:
1.Alguém reiniciou o IIS, por exemplo usando o comando iisreset;
2.Alguém alterou o web.config;
3.Alguém alterou algum arquivo da pasta app_code;
4.Na aplicação existe alguma rotina que altera a estrutura de diretórios, por exemplo deletar uma pasta de fotos de uma galeria;
5.Reciclagem do appPool no IIS6.
6.Quando ocorre alguma excessão
Configuração no web.config
No web config tem um timeout em minutos. Valor default 20, valor máximo: 1440 (1 dia)
<configuration>
<system.web>
<sessionState timeout="1440"/>
</system.web>
</configuration>
Configuração no IIS
Mesmo configurando o webconfig não adianta. Você deve configurar no IIS. Eu testei no IIS do Windows Server 2003 e funcionou.
Peguei de um fórum na web:
Config #1
Change the following time-outs in Internet Services Manager .Choose a value greater than the default of 20.
1. Select Default Web Site > Properties > Home Directory > Application Settings > Configuration > Options.
2. Enable the session state time-out and set the Session timeout for 60 minutes.
3. Select Application Pools > DefaultAppPool > Properties.
4. From the Performance tab under Idle timeout, set Shutdown worker processes after being idle for a value higher than 20.
Config #2
1. Start Internet Services Manager 5.0.
2. For explicit authentication, right-click the /Citrix/MetaFrameXP/default virtual directory and view the Properties.
For desktop credentials, pass-through users edit the /Citrix/MetaFrameXP/integrated virtual directory.
For Smart Card users, edit the /Citrix/MetaFrameXP/certificate virtual directory.
3. In the Application Settings section, click Configuration.
4. Select the App Options tab.
5. Ensure Enable session state is selected.
Fonte: