Re: Unable to access system environment variables under IIS 6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Scott Frazer (sfrazer_at_gmail.com)
Date: 07/20/04


Date: Tue, 20 Jul 2004 09:59:19 -0400

On Mon, 19 Jul 2004 19:23:25 -0700, "David Wang [Msft]"
<someone@online.microsoft.com> wrote:

>The behavior looks by-design to me -- nothing to fix or set.
>
>1. Changing system environment variable requires rebooting the server for it
>to be visible in IIS (and ASP.Net by extension since IIS launches ASP.Net
>pages, which in turn inherits its environment). This is because IIS is
>ultimately launched by services.exe and inherits its environment, and you
>cannot restart services.exe (so that it picks up the system environment
>change) without rebooting the server.

this was it. I'm amazed I hadn't rebooted the server yet.

>2. Make sure you are actually comparing the same environment -- I don't
>think you're even comparing the same users. The ASP.Net page reports
>"LocalService" while yours report "scott.frazer" -- so no wonder the values
>are different. Also, the type of user logon also affects the user
>environment and privileges -- your user is an interactive logon, and IIS's
>is not.
>
>I believe rebooting your server after changing the system environment should
>satisfy your current questions of environment variable visibility within
>IIS.
>
>You can observe the same behavior with #1 yourself by:
>1. launch CMD.EXE
>2. Change System environment variables
>3. from the CMD.EXE in #1, launch another CMD.EXE (either use "start" or cmd
>again) and check its environment variables. Notice that the system
>environment change is not made. Now, launch CMD.EXE from the Start Menu's
>"Run" or a link to CMD.EXE -- notice it sees the system environment change.



Relevant Pages

  • Re: GenEnvironmentVariable and CreateProcess failures under XP
    ... environment variable was not found in the environment block. ... If you first call GetEnvironmentVariable with a 0-length string, ... It does not affect the "system environment" that other ... CreateProcess to launch Notepad or other Win32 executables. ...
    (microsoft.public.vb.winapi)
  • Re: odd behavior on client installation
    ... And being an environment variable, ... keys, *AND* clean up the system environment ... expecting, leading to my purge of Oracle from the system being ... presence of environment settings being set from places I had never ...
    (comp.databases.oracle.server)
  • RE: SetEnvironmentVariable in Debug and Release cofiguratin
    ... Calling SetEnvironmentVariable has no effect on the system environment ... The user can add or modify system environment variables using the ... Control Panel. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4
    ... it inherits its environment at boot time from the Service ... which has only the values of the System Environment ... if anything is defined or else goto the registery to get the ... For an appln started from the shell, ...
    (microsoft.public.win32.programmer.kernel)
  • RE: Binding Windows Services to Specific Addresses Only
    ... Document the server. ... If this is a corporate environment, ... Install the minimums. ... The network configuration for the server should restrict what the server has ...
    (Focus-Microsoft)