Blender not running under IIS7 I would like to use Blender 2.78c (64bit, from zip file) to perform rendering tasks on my IIS7 server running at a Win7 machine. The server uses ASP.NET and C# to create a new process which starts Blender in the command line and renders a predefined scene. Basically the process calls

C:\path-to-blender\blender.exe -b -noaudio file-with-a-python-script-to-render.blend -- some_input_arguments


Everything works fine while I am locally in the Debug mode using Visual Studio's internal IIS Express. I get nice renderings, no errors and no problems. However, once published and executed from the IIS the Blender fails to start. It crashes with the following stderr:


  Fatal Python error: Py_Initialize: can't initialize sys standard streams OSError: [WinError 6] The handle is invalid Current thread 0x00002f78 (most recent call first):


It seems there is a problem initializing Python for Blender. Blender folder and its python subfolder are owned by the user account of the web worker, so that should be no problem. I am not sure if this is the right place to ask, but all my search on this topic failed yet. I only found this https://stackoverflow.com/questions/38725037/deploy-blender-to-azure-app which does not provide a good answer. I hope someone can help ...
After 30 hours of trying, I am very happy that I made it work! Not sure whether this workaround is safe, but yet it works for Blender 2.78:


Rename blender-dir\2.78\python to something else, e.g. blender-dir\2.78\python-old
Download the embeddable zip of Python 3.5.3 from https://www.python.org/downloads/release/python-353/
Unpack its content to blender-dir\2.78\python (a new directory using the same name)
Unpack its blender-dir\2.78\python\Python35.zip to blender-dir\2.78\python\lib
Copy contents of blender-dir\2.78\python-old\lib\site-packages to  blender-dir\2.78\python\lib\site-packages except for __pycache__ directories
I am not sure yet whether any other files or directories need to be copied from python-old\lib to python\lib, if yes I will update the answer.
Find all __pycache__ directories in blender-dir\2.78\scripts\ and delete them
Copy blender-dir\2.78\python\python35.dll to blender-dir replacing the old python35.dll


So the issue is resolved by pushing in Python 3.5.3. I hope Blender will bundle it in its next release. In the meanwhile, please let me know in a comment in case anyone else encounters a similar problem :)