Re: Keep Socket connection open in ATL Server (ISAPI)
- From: Charles Zhang <CharlesZhang@xxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Mar 2007 00:12:38 -0700
Thank you very much for the timely response.
I am developing the ISAPI using Windows XP/IIS5.
I do not have controls over production servers so the ISAPI must support both IIS5 and IIS6.
You mentioned ISAPI itself does not have control over its lifetime.
But looks like it is a troublesome task to configure IIS to make sure the DLL will not be unloaded.
Are there any other ways to hold the socket handles?
For instance, creating a Windows Service (executable file) to hold the sockets then using memory sharing to share the socket handle between ISAPI and the Windows Service?
Another idea is creating a idle thread ( endless loop calling Sleep API)
when the DLL is loaded. Does the idle thread prevent the DLL from being unloaded?
Or any other ideas?
Thanks
Charles Zhang
Steven Cheng[MSFT] wrote:
Hello Charles,.
From your description, I understand you've used ATL Server project to develop a ISAPI extension based server application. You want to make the connection from ISAPI to server application keeped from session to session(based on client request), however, you found the ISAPI extension module will be unloaded periodically, correct?
Regarding on this problem, I'd like to confirm whether you've developing the ATL server project(and test the compiled components) on XP/IIS5 or WIN2K3 server/IIS6. Based on my experience, the ISAPI code itself doesn't have particular settings to control its lifetime or cycle. It is the IIS server process which control the load/unload lifecycle of those installed ISAPI components. Normally, if the IIS site/virtual dir has choosen to cache ISAPI extension, the extension dll will be loaded at the first request of the corresponding service document/url, and it will be unloaded until the hosting IIS worker process be unloaded(shutdown or recycle). Here are two blog articles from David Wang's weblog which has included discussion on this:
http://w3-4u.blogspot.com/2006/12/qa-on-process-threading-and-dll.html
http://blogs.msdn.com/david.wang/archive/2005/10/14/HOWTO_IIS_6_Request_Proc
essing_Basics_Part_1.aspx
For your case here, you can also monitor the hosting IIS worker process of your extension dll(for IIS6, it is w3wp while for IIS5, it may vary depend on the "Protection Level" of the application virtual dir) to see whether it is because the worker process shutdown/recycle that make your ISAPI extension dll unloaded. For IIS5, you can set your webserver application virtual dir's "protection level" to "high" so that it is hosted in a single separate worker process(dllhost.exe). For IIS6, you can configure your application virtual dir to use a separate Application Pool so that it will be hosted in a individual worker process(w3wp.exe)
#Configure Application Isolation Settings for IIS 5.0 Isolation Mode
http://technet2.microsoft.com/WindowsServer/en/library/0f18f73b-03cf-4f81-92
e2-d6ee4f248c401033.mspx?mfr=true
And for IIS6, there is a setting of Application Pool to control how long idle time it will wait before the worker process(of that application pool) be shutdown, you can find it in Application Pool's setting.
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/8
3b35271-c93c-49f4-b923-7fdca6fae1cf.mspx?mfr=true
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- Re: Keep Socket connection open in ATL Server (ISAPI)
- From: Charles Wang[MSFT]
- Re: Keep Socket connection open in ATL Server (ISAPI)
- References:
- Keep Socket connection open in ATL Server (ISAPI)
- From: Charles Zhang
- RE: Keep Socket connection open in ATL Server (ISAPI)
- From: Steven Cheng[MSFT]
- Keep Socket connection open in ATL Server (ISAPI)
- Prev by Date: RE: Keep Socket connection open in ATL Server (ISAPI)
- Next by Date: Re: Why does this function cut last two characters off end of string?
- Previous by thread: RE: Keep Socket connection open in ATL Server (ISAPI)
- Next by thread: Re: Keep Socket connection open in ATL Server (ISAPI)
- Index(es):
Relevant Pages
|