Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the IIS Application Pool Identity User Locale when it's set to ApplicationPoolIdentity

Tags:

To clarify the title.

When you create an application pool in IIS you give it a name. You can then set the identity to ApplicationPoolIdentiy.

Windows then creates this magic user you can't see. Say the app pool name is MyTestAppPool so you would end up with a user called MyTestAppPool (IIS AppPool\MyTestAppPool)

When this happens Windows uses the servers current locale. Let's say it was US at the time.

Then later you change it to UK. While there is a copy this doesn't copy to these magic users I've found. So your server is set to UK while your MyTestAppPool is set to US.

So when a website runs and you need to say format something to currency in the correct locale you end up with US currency because of the AppPool instead of UK currency.

Is there a way to change the AppPool user's locale?

The only way I have found is to delete the app pool and recreate it again after you've set the servers locale to what you want. What if I don't want to do that.

What if I need to have multiple websites running in different locales how would I set the AppPoolIdentity user locale to each of these without having to change the server to what I want before I create the apppool?

like image 511
Chris Ward Avatar asked Mar 18 '15 19:03

Chris Ward


People also ask

How do I give permission to application pool identity?

Click the Locations button and make sure that you select your computer. Enter IIS AppPool\<myappoolname> (eg: IIS AppPool\PK Protect) in the Enter the object names to select: text box. Click the Check Names button and click OK. Check Modify under the Allow column, and click OK, and OK.

What is IIS ApplicationPoolIdentity?

ApplicationPoolIdentity: When a new application pool is created, IIS creates a virtual account that has the name of the new application pool and that runs the application pool worker process under this account. This is also a least-privileged account.


2 Answers

When you create and use an App Pool Identity, a "user" is created and there is a folder at C:\Users\AppPoolName.

In C:\Windows\System32\inetsrv\config\applicationHost.config there is an element which on my machine looks like this:

<applicationPoolDefaults managedRuntimeVersion="v4.0">
  <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>

The combination of these two settings determines the environment (and thus locale) settings that app pool identity runs as.

You should be able to figure out the unique Id by checking in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist for the user that loads the ..\Users\AppPoolName\NTUSER.DAT and then match it up with the settings in HKEY_USERS\UnqiueId\ControlPanel\International\Locale settings.

It may just be simpler to set setProfileEnvironment="false" unless you need the settings.

like image 85
ste-fu Avatar answered Sep 21 '22 16:09

ste-fu


You can set the culture of your application via web.config or on page level. This should override the application pool user's culture.

have a look at this https://msdn.microsoft.com/en-us/library/bz9tc508(v=vs.140).aspx

like image 24
Trekco Avatar answered Sep 18 '22 16:09

Trekco