HttpPlatformHandler not creating stdoutLogFile, ErrorCode = '0x80070005'.

Hello,

Trying to deploy a totally default django project through IIS with HttpPlatformHandler though this tutorial: Running Django Web Apps on IIS with HttpPlatformHandler | Half-Blood Programmer. Currently it just loads forever without an error, but when looking at the Event Viewer I’m getting several errors:

  1. Could not create stdoutLogFile D:\apps\mysite\logs\python.log_20250722162931_18580.log, ErrorCode = ‘0x80070005’.
  2. Application ‘/LM/W3SVC/3/ROOT’ with physical root 'D:\apps\mysite' failed to start process with commandline ‘“” manage.py runserver %HTTP_PLATFORM_PORT%’ at stage ‘PostStartCheck’, ErrorCode = ‘0x8027025a’, assigned port 36562, retryCounter ‘1’.
  3. Application ‘/LM/W3SVC/3/ROOT’ with physical root 'D:\apps\mysite' failed to start process with commandline ‘“” manage.py runserver %HTTP_PLATFORM_PORT%’ at stage ‘PostStartCheck’, ErrorCode = ‘0x8027025a’, assigned port 19990, retryCounter ‘0’.
  4. Application ‘/LM/W3SVC/3/ROOT’ with physical root 'D:\apps\mysite' failed to start process with commandline ‘“” manage.py runserver %HTTP_PLATFORM_PORT%’ with multiple retries. Failed to bind to port ‘19990’. First 30KB characters of captured stdout and stderr logs from multiple retries:

The user assigned to run the python through IIS has permission to write to the log folder but I don’t understand why it is not.

Welcome @ccowin-odhsoha !

I don’t deploy Django on Windows, and I haven’t deployed anything on IIS for about 15 years now, but there are just a couple items I’ll mention here.

  • Don’t deploy using runserver. Quoting directly from the docs for runserver:

Warning
DO NOT USE THIS SERVER IN A PRODUCTION SETTING.

It appears that Waitress may currently be the best option for a Windows-based WSGI server. I do see where you can also use uvicorn if you want to use ASGI.

  • Second item -

This is absolutely a permissions issue. You either need to dig deeper to identify exactly where and why this is happening, or else use a different directory owned by IIS and with permissions granted to the user running the python process.