开发者

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

开发者 https://www.devze.com 2023-04-05 13:48 出处:网络
My current understanding of 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 understanding of 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.

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. 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.

You are fighting against core features of IIS and its application lifetime management and health monitoring. 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). Basically it is bad idea - let IIS do its job or host application yourselves and build your own health monitoring.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号