[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

lifetime of MBR Component hosted in IIS

Robin Prosch via .NET 247

9/16/2004 2:09:00 AM

(Type your message here)
recently I build a Asp.Net Application and use Remoting to connect to a .Net
MBR Component hosted in IIS.Because the MBR Component need use large Cache
which need long time to be initialized,I want to make the MBR Component
create once and run at all times,So I override InitializeLifetimeService()
of the MBR Component,the code likes:
public override Object InitializeLifetimeService()
{
ILease lease = (ILease)base.InitializeLifetimeService();
if (lease.CurrentState == LeaseState.Initial)
{
lease.InitialLeaseTime = TimeSpan.Zero;
lease.SponsorshipTimeout = TimeSpan.Zero;
lease.RenewOnCallTime = TimeSpan.Zero;
}
return lease;
}

all looks right,before overide InitializeLifetimeService()
i test the lifeTime MBR is five minutes(the MBR Component holds a variable whose
value is exclusive for each instance),after override it becomes
several hours, not all times;

Does somebody can tell me how I fix the problem?
--------------------------------
From: xie yongzhi

-----------------------
Posted by a user from .NET 247 (http://www.dotn...)

<Id>eR9M606mzEmflneGlEUCTA==</Id>
2 Answers

Ken Kolda

9/16/2004 3:56:00 PM

0

My guess would be that either ASP.NET or IIS is recycling your remoting
server web app. This can happen under various conditions, such as a
specified amount of time elapses, the app has handled a certain number of
requests, etc. It can also happen if a file in the web app's folder is
modified (which can often be trigger by anti-virus software). You may want
to add some logging (e.g. to the event log) in your Application_End event
handler to see if the app is being terminated unexpectedly. Also, you can
turn on logging in the <processModel> tag of the machine.config file
(assuming you're using IIS 5) to see if the process is being recycled.

Ken


"xie yongzhi via .NET 247" <anonymous@dotnet247.com> wrote in message
news:OYVGkI5mEHA.3820@TK2MSFTNGP09.phx.gbl...
> (Type your message here)
> recently I build a Asp.Net Application and use Remoting to connect to a
..Net
> MBR Component hosted in IIS.Because the MBR Component need use large Cache
> which need long time to be initialized,I want to make the MBR Component
> create once and run at all times,So I override InitializeLifetimeService()
> of the MBR Component,the code likes:
> public override Object InitializeLifetimeService()
> {
> ILease lease = (ILease)base.InitializeLifetimeService();
> if (lease.CurrentState == LeaseState.Initial)
> {
> lease.InitialLeaseTime = TimeSpan.Zero;
> lease.SponsorshipTimeout = TimeSpan.Zero;
> lease.RenewOnCallTime = TimeSpan.Zero;
> }
> return lease;
> }
>
> all looks right,before overide InitializeLifetimeService()
> i test the lifeTime MBR is five minutes(the MBR Component holds a variable
whose
> value is exclusive for each instance),after override it becomes
> several hours, not all times;
>
> Does somebody can tell me how I fix the problem?
> --------------------------------
> From: xie yongzhi
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotn...)
>
> <Id>eR9M606mzEmflneGlEUCTA==</Id>


Scott

9/16/2004 6:29:00 PM

0

For an infinite lifetime on a singleton object, override the
InitializeLifetimeService() method and return null;

Scott L.


"xie yongzhi via .NET 247" <anonymous@dotnet247.com> wrote in message
news:OYVGkI5mEHA.3820@TK2MSFTNGP09.phx.gbl...
> (Type your message here)
> recently I build a Asp.Net Application and use Remoting to connect to a
..Net
> MBR Component hosted in IIS.Because the MBR Component need use large Cache
> which need long time to be initialized,I want to make the MBR Component
> create once and run at all times,So I override InitializeLifetimeService()
> of the MBR Component,the code likes:
> public override Object InitializeLifetimeService()
> {
> ILease lease = (ILease)base.InitializeLifetimeService();
> if (lease.CurrentState == LeaseState.Initial)
> {
> lease.InitialLeaseTime = TimeSpan.Zero;
> lease.SponsorshipTimeout = TimeSpan.Zero;
> lease.RenewOnCallTime = TimeSpan.Zero;
> }
> return lease;
> }
>
> all looks right,before overide InitializeLifetimeService()
> i test the lifeTime MBR is five minutes(the MBR Component holds a variable
whose
> value is exclusive for each instance),after override it becomes
> several hours, not all times;
>
> Does somebody can tell me how I fix the problem?
> --------------------------------
> From: xie yongzhi
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotn...)
>
> <Id>eR9M606mzEmflneGlEUCTA==</Id>