问题
I've understood that, in order to make IIS read a new environmental variable, I have to reset it via an administrator's command:
iireset /restart
I know that one can also restart IIS from the admin panel at server level. More context to my complete web app setup in my previous question/answer: in brief it is a Python Flask app running on IIS through WSGI and FastCGI.
What is still surprising me is that now, if I delete a previously created environmental variable, IIS keep seeing it, even after restarting it, as done above.
Why is that possibly happening? And how should I delete the variable for IIS?
回答1:
If you insist that you want to go with environmental variables (notice that you also have the alternative .env
file), then you need to set them via the IIS FastCGI Settings from the IIS admin at server level for your specific application (the one you enabled via wfastcgi-enable
).
Edit the specific row as said above and you'll find the Environment Variables collection under the "General" group of FastCGI Properties.
Now you can add and delete any of those variables and it will take effect immediately, without the need of any IIS reboot.
来源:https://stackoverflow.com/questions/65871980/deleting-an-environmental-variable-for-iis