Windows Server 2008 RS2 上运行的 IIS 7.5 中的 TISAPI 应用程序生命周期:
我试图弄清楚如何在 IIS 7.5 中控制 TISAPIApplication (用 Delphi XE 编写)的生命周期 - 看到意外的行为:
ISAPI 应用程序池和 IIS/ISAPI 配置的所有级别都设置为在特定系统帐户下以匿名访问方式运行,从 WebServer 本身到 VD、appPool 和特定 dll - 这永远不会改变。但每次不同的用户发出请求时,或相同的请求用户打开一个新的浏览器会话,webApplication 被重新初始化。
我预计 webApp 仅在第一次点击时、或者当 IIS 重置或应用程序池被回收时才会初始化。这是我期望和需要的行为 - web 应用程序应该是一个 SINGLETON ,它为每个新请求生成一个线程,无论用户或用户会话如何。
客户端正在运行 IIS 8 或 FireFox 6(我认为这是无关紧要的 - 我观察到的它们之间的差异与浏览器缓存方案等有关,而不是与 ISAPI 应用程序有关)。
客户端运行的是 Win XP SP3 或 Win 7 64 - 操作系统似乎对此行为没有影响。
监视/反馈:
每次 ISAPI 应用程序初始化时,我都会在事件日志中记录一个条目,并在网页中返回一个计数器,指示应用程序在初始化后处理的请求数(截至该请求)。
我在 IIS 7.5 应用程序池级别使用过各种“高级设置” - 到目前为止还没有运气。
任何人都可以解释我所看到的行为,以及如何对其进行更改,以便 TISAPIApplication 实例的行为像单例吗?
I am trying to figure out how to control the lifetime of a TISAPIApplication (written in Delphi XE) in IIS 7.5 - seeing unexpected behavior:
The ISAPI application pool and ALL LEVELS of IIS/ISAPI configuration are set to run with anonymous access under a specific system account, from the WebServer itself to the VD, appPool and specific dll - this NEVER changes. But each time a different user makes a request, or the same user opens a new browser session, the webApplication is reinitialized.
I expected that the webApp would be initialized only on first hit, or when IIS is reset or the app pool is recycled. This is the behavior I expected and that I NEED - the webApp should be a SINGLETON that spawns a thread for each new request, regardless of user or user sessions.
Clients are running IIS 8 or FireFox 6 (I believe this is irrelevant - differences between them I have observed are related to browser caching schemes, etc, not to the ISAPI application).
Clients are running Win XP SP3 or Win 7 64 - OS seems to have no impact on the behavior.
Monitoring/Feedback:
I am logging an entry in the event log each time the ISAPI app initializes, and returning a counter in a webPage indicating the number of requests the app has handled after initialization, as of that request.
I have worked with various 'advanced settings' at the IIS 7.5 application pool level - no luck so far.
Can anyone explain the behavior I am seeing, and how to go about changing it so that the TISAPIApplication instance behaves like a singleton?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
难道 IIS 正在启动多个 w3wp.exe 实例来加载您的 ISAPI dll,并且您在每个实例启动时都会收到一条 Web 应用程序初始化消息?有一个应用程序池设置限制了同时运行的 w3wp.exe 的数量。在某些情况下,此设置的最佳值为 1。
Could it be that IIS is launching multiple w3wp.exe instances to load your ISAPI dll, and you get a webapplication initialization message from each when it starts? There's an application pool setting limiting the number of w3wp.exe's running alongside eachother. In some cases the best value for this setting is 1.