| Login

Search this Blog

Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Sep12

Written by:R Teachout
9/12/2008 9:48 AM 

Just a "hack" way to fix this issue, without restarting the entire machine.

To add environment variable overrides Temporarily to be reflected in IIS do the following:

REG.EXE add "HKLM\SYSTEM\CurrentControlSet\Services\IISADMIN\Parameters\Environment" /v TMP /t REG_SZ /d "C:\windows\temp" /f

REG.EXE add "HKLM\SYSTEM\CurrentControlSet\Services\IISADMIN\Parameters\Environment" /v TEMP /t REG_SZ /d "C:\windows\temp" /f

iisreset (to activate the changes)

You should also manually update them in the computer properties as well, so they are there for the next reboot.

I also recommend after an IISreset to remove the new variables you put in place with:
REG.EXE DELETE "HKLM\SYSTEM\CurrentControlSet\Services\IISADMIN\Parameters\Environment"

Reasoning:
IIS gets env vars from services.exe which only gets updated on a reboot.
Using the above override tells a particular service to use special variables. Then just restarting that service gets those updates.. (note, doesn't work for all services, but does appear to work for IIS)

So it just uses the system environment instead.. that's really a better solution.

Note:  If you can just manually change the env vars and reboot, then do not run the above commands, and just do that, a it is a much better solution.. this is just a way to fix it without the entire system reboot.


What errors this can help with:

Here's an example error

CS0016: Could not write to output file 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\xyz\6668f6c65\c11498a0\App_Web_defaultwsdlhelpgenerator.aspx.cdcab7d2.lelbhjr9.dll' -- 'The directory name is invalid. '

Doing the above (or env vars and a system restart) make this error go away.. the error is misleading, as that path DOES exist, it's just the temp file built during the compilation to go in that directory gets lost, so the above error is what is displayed.. dumb, but once you understand this, when you see this error, it's env vars!

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment  Cancel 


-BrainyQuote.com

Inspired by Nina