ASP.NET Web API Application Pool for each Controller with different user

1.3k Views Asked by At

I want to define a separate "Application Pool" in ASP.NET Web API
for each Controller with different user to execute under

I want it for defining a separate user name for each controller that without using the Impersonation class. Each user credentials for each App Pool (w3wp.exe) for each controller

In ASP.NET classic (and in WCF), I have made it using Folder for each handler (ASMX or custom) that host and define a local web.config of its own, with the configuration in the IIS for each folder (will define as IIS Application)

One of the alternatives is to: Create several Web Applications for each controller - bad design That's the option I prefer to avoid ...

My scenario is: I have to run and execute 3 services under 3 difference application user accounts, I know the option and the alternative of using Impersonation Class and provide a username and password within the code itself, that option is bad because, I have to save and manage the username and pw in config file ... I want the username and pw will be at the service level configure by IT team as part of the App Pool IIS config

Can i get this action and capabilities using Web API for each conroller?

Thanks Itzik BS

1

There are 1 best solutions below

3
On

As far as I can say, this is not possible as the Application Pool is set per Web Application.

You could create several Web Applications each hosting one controller but that does not sound like a good solution.

Maybe it would help if you give more details as what problem you are trying to solve with this solution.