0

我正在 Windows Server 2019 上使用 Django 和 IIS 10 Web 服务创建一个 Web 应用程序。我wfastcgiweb.config. 日志内容:

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

每小时 wfastcgi 提出OSError: [Error 22]并运行退出任务,几分钟后重新启动。我添加了以下行web.config但没有任何影响:

<add key="SCRIPT_NAME" value="/Music_backend" />

整个 web.config 文本如下:

<?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>

此外,我激活了 Django.server、Django.request、Django.db.Backend、LOGGING 选项,但在所有日志文件中都没有看到任何证据。我知道问题可能出在包含不带"r"前缀路径的字符串中,但没有任何日志文件可用于检测问题。非常感谢您的帮助!

4

0 回答 0