![]() |
How to control the application end time then 2-nd instance started?
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. |
RE: How to control the application end time then 2-nd instance started?
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.) |
Re: How to control the application end time then 2-nd instance started?
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. |
Re: How to control the application end time then 2-nd instance started?
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.) |
Re: How to control the application end time then 2-nd instance started?
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/is.../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. |
Re: How to control the application end time then 2-nd instance started?
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.) |
| All times are GMT. The time now is 08:41 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.