How to control the application end time then 2-nd instance started?

A

Alexander Inochkin

Hello.

I have a working ASP.NET service. I am using .NET Framework 1.1; IIS V6.0.
(web garden not used)

When I change web.config file or load new *.dll, my service restarts,
and about 90 seconds two versions(instances) of my application exists.

Is anybody know how to minimize the time between starting of the new
version(instance) of application and the application end of previous
instance. (I am using asynchronous request processing in my service.)

Alexander.
 
S

Steven Cheng[MSFT]

Hi Alexander,

Welcome to ASPNET newsgroup.
As for the application restarting , this is a normal behavior since
changing web.config or private "bin" folder will make the current
application's setting invalid so the runtime will stop the current
appdomain and restart new one.

Also, the actual point on when the orginal appdomain shutdown and the new
one started can not be retrieved exactly since the runtime need to do some
additinoal resource backup and colleciton operations before end the old
instance or do some initialization steps before start up new one.
Currently the only events we can make use of are the

Application_Start and Application_End events in the Global.asax class

Is it possbile that we put our own customized backup and initialization
code there?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Alexander Inochkin

Some of my external programs (let's call it "Receivers") permanently
connected to the ASP.NET
application, and processing long running requests (receiving data that
other external programs calling "clients" send). "clients" connects to
ASP.NET
application every time they want to send data (many times a second).
When new version of ASP.NET application started, there are 2 instances
of ASP.NET application and "clients" begin connecting to the new
ASP.NET instance. In this point of time "Receivers" still connected to the
previous
instance of ASP.NET (they reconnect only after Application_End event).
In that period of time, about 90 seconds, "clients" and "Receivers"
works in different instances and can't send data to each other using
application internal arrays of data.
Tell me please how to reconnect long running "Receivers" at the time when
new instance start or to speed up Application_End event for the previous
instance?

In ASP.NET I am using asynchronous request processing for the
"Receivers":

public IAsyncResult BeginProcessRequest(HttpContext ctx,
AsyncCallback cb,
object obj)
{
AsyncRequestState reqState =
new AsyncRequestState(ctx, cb, obj);
AsyncRequest ar = new AsyncRequest(reqState);
ThreadStart ts = new ThreadStart(ar.ProcessRequest);
Thread t = new Thread(ts);
t.Start();

return reqState;
}


Thanks in advance,
Alexander.
 
S

Steven Cheng[MSFT]

Thanks for your further description Alexander,

So the connection between the "receivers" and ASP.NET are established when
you start the async thread in your asynhandler's BeginProcessRequest, yes?
How does the external program(receivers) interact with asp.net?

Anyway, currently we haven't any means to maually inject into the
Applciation's Restart steps to speed up or delay the shutdown period. If
you do need to avoid the receivers program continue connecting to the old
appdomain(when restart occurs), I think we may need to provide our custom
Synchorizing code , such as using a global event object to identity whether
new appdomain started and reject all the processes from old appdomain.

BTW, I'm confused as you use ASP.NET as the middle tier of your system.
clients send request to ASP.NET and ASP.NET connect to recievers to let it
process requests. Since ASP.NET is designed for user interactive web
application, it's buildin HTTP async pipline may not suit your scenario
well. Is it possible that we consider some other services as the middle
tier, such as .net remoting or MSMQ?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Alexander Inochkin

Thanks for replay. Now it's not possible to rewrite applications,
but in future, we will do it as you say (ASP.NET will connect to
other middle tire that will work with recievers).

About asynchronous request processing:
Yes. I am using async thread in my application as written below:
Asynchronous Handler with Custom Threads
http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/
How does the external program(receivers) interact with asp.net?
Receivers connects to the ASP.NET service and then only continuously
receive some string data (one very long query). Receivers reconnects only
on network, software or other error.

Thank you ever so much.
Alexander.
 
S

Steven Cheng[MSFT]

You're welcome Alexander,

If there'r anything we can help later, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top