简体   繁体   English

限制IIS中每个工作进程的应用程序域数量(并禁用应用程序域的重复回收)

[英]Limiting number of app domains per worker process in IIS (And disabling overlapped recycling of app domains)

My current understanding of IIS: 我目前对IIS的了解:

An application pool maintains a collection of worker processes (Operating system processes), within each worker process there is one or more app domains. 应用程序池维护一组工作进程(操作系统进程),每个工作进程中都有一个或多个应用程序域。

My current problem: 我目前的问题:

We currently used a third party dll in native code, our managed code talks to this. 我们目前在本机代码中使用了第三方dll,我们的托管代码对此进行了说明。

This native code can only be initialized once per operating system process. 每个操作系统进程只能将此一次本地代码初始化一次。

When we have more than one app domain per worker process, the native code blows up (As the initialize logic of the native code gets called more than once for the current process). 当每个工作进程有多个应用程序域时,本机代码会崩溃(因为当前进程不止一次调用本机代码的初始化逻辑)。

My ideal short term workaround (Until the third party fixes this issue): 我理想的短期解决方法(直到第三方解决此问题):

I would like to limit the number of app domains running at any one time within a worker process to one. 我想将一个工作进程中任何时候运行的应用程序域的数量限制为一个。 I also want to disable overlapped recycling of app domains within worker processes. 我还想禁用工作进程中应用程序域的重叠回收。 Is this possible? 这可能吗? And if so how? 如果是这样怎么办?

In IIS I cannot see a way to limit the app domains, only the worker processes. 在IIS中,我看不到一种限制应用程序域的方法,只能限制工作进程。 I can also not see a way to disable overlapped recycling of app domains, again this option only exists for worker processes. 我也看不到禁用应用程序域重叠回收的方法,同样,此选项仅适用于工作进程。

I realize this will impact our performance somewhat, for example by disabling overlapped recycling of app domains we will get service interruptions. 我意识到这会在一定程度上影响我们的性能,例如,通过禁用应用程序域的重复回收,我们将导致服务中断。 I'm OK with this as overall is will enable us to improve performance with the current changes we are trying to make. 我可以接受,因为总体而言,这将使我们能够通过尝试进行的当前更改来提高性能。

I also understand that this may require some registry hacking etc. but this is fine for a temporary workaround. 我也了解,这可能需要一些注册表入侵等,但这对于临时解决方法是很好的。

Any suggestions will be much appreciated! 任何建议将不胜感激!

Use self hosting or wrap the access to native code library into separate self hosted code accessed through named pipes from IIS hosted application. 使用自托管或将对本机代码库的访问包装到单独的自托管代码中,这些代码通过IIS托管应用程序中的命名管道进行访问。

You are fighting against core features of IIS and its application lifetime management and health monitoring. 您正在与IIS的核心功能及其应用程序生存期管理和运行状况监视作斗争。 To turn off some features you must visit configuration of AppPool and set its Recycling and Advanced settings to turn off every related features (I'm not sure if it will solve all your problems). 要关闭某些功能,您必须访问AppPool的配置并设置其“回收”和“高级”设置以关闭所有相关功能(我不确定它是否能够解决您的所有问题)。 Basically it is bad idea - let IIS do its job or host application yourselves and build your own health monitoring. 基本上,这是个坏主意-让IIS自行完成工作或托管应用程序并构建自己的运行状况监视。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM