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

Discussion in 'ASP .Net' started by Alexander Inochkin, May 30, 2005.

  1. 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 Inochkin, May 30, 2005
    1. Advertisements

  2. 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!
    (This posting is provided "AS IS", with no warranties, and confers no
    Steven Cheng[MSFT], May 31, 2005
    1. Advertisements

  3. 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
    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
    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

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

    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);

    return reqState;

    Thanks in advance,
    Alexander Inochkin, May 31, 2005
  4. 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

    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?


    Steven Cheng
    Microsoft Online Support

    Get Secure!
    (This posting is provided "AS IS", with no warranties, and confers no
    Steven Cheng[MSFT], Jun 1, 2005
  5. 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

    > How does the external program(receivers) interact with

    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 Inochkin, Jun 1, 2005
  6. You're welcome Alexander,

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


    Steven Cheng
    Microsoft Online Support

    Get Secure!
    (This posting is provided "AS IS", with no warranties, and confers no
    Steven Cheng[MSFT], Jun 2, 2005
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Math
    Grant Edwards
    Mar 13, 2006
  2. flamesrock
    Hendrik van Rooyen
    Nov 24, 2006
  3. Nagesh
    Bob Barrows
    Jul 28, 2003
  4. Replies:
  5. Jake Barnes

Share This Page