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.
     
    Alexander Inochkin, May 30, 2005
    #1
    1. Advertising

  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! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], May 31, 2005
    #2
    1. Advertising

  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
    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.
     
    Alexander Inochkin, May 31, 2005
    #3
  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 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.)
     
    Steven Cheng[MSFT], Jun 1, 2005
    #4
  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
    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.
     
    Alexander Inochkin, Jun 1, 2005
    #5
  6. 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.)
     
    Steven Cheng[MSFT], Jun 2, 2005
    #6
    1. Advertising

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
    Replies:
    1
    Views:
    299
    Grant Edwards
    Mar 13, 2006
  2. flamesrock
    Replies:
    8
    Views:
    547
    Hendrik van Rooyen
    Nov 24, 2006
  3. Nagesh
    Replies:
    1
    Views:
    124
    Bob Barrows
    Jul 28, 2003
  4. Replies:
    0
    Views:
    336
  5. Jake Barnes
    Replies:
    2
    Views:
    331
Loading...

Share This Page