What causes Unhandled exception in wfastcgi.py: Traceback (most recent call last) in Django +IIS
I' m creating a web app with Django and IIS 10 web service on windows server 2019. I have problem in the wfastcgi
log file that is configured in web.config
. The content of the log:
2021-12-10 16:26:35.568572: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
File "c:\python37\lib\site-packages\wfastcgi.py", line 774, in main
record = read_fastcgi_record(fcgi_stream)
File "c:\python37\lib\site-packages\wfastcgi.py", line 158, in read_fastcgi_record
data = stream.read(8) # read record
OSError: [Errno 22] Invalid argument
2021-12-10 16:26:35.615397: Running on_exit tasks
2021-12-10 16:26:35.646693: wfastcgi.py 3.0.0 closed
2021-12-10 16:59:42.309400: wfastcgi.py will restart when files in C:\inetpub\wwwroot\ are changed: .*((\.py)|(\.config))$
2021-12-10 16:59:42.340650: wfastcgi.py 3.0.0 initialized
Every hour wfastcgi raise OSError: [Error 22]
and run exit task, after minutes restart again. I added the following line to web.config
but no any impact:
<add key="SCRIPT_NAME" value="/Music_backend" />
Whole web.config text is bellow:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
</system.webServer>
<appSettings>
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\Music_backend" />
<add key="WSGI_HANDLER" value="Music_backend.wsgi.application" />
<add key="DJANGO_SETTINGS_MODULE" value="Music_backend.settings" />
<add key="SCRIPT_NAME" value="/Music_backend" />
<add key="WSGI_LOG" value="c:\wfastcgi.log"/>
</appSettings>
<location path="" overrideMode="Deny">
<system.webServer>
</system.webServer>
</location>
<location path="" overrideMode="Allow">
<system.webServer>
<handlers>
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\python37\python.exe|c:\python37\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</location>
</configuration>
In addition I activated Django.server, Django.request, Django.db.Backend, LOGGING option but no any evidence see in all log file.
I know that problem maybe is in a string that include path without "r"
prefix, but no any log file is available for detect problem.
Many Thanks for any help!