C:\Users\XXX>wfastcgi-enable
ERROR ( message:New application object missing required attributes. Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments' respectively set to 'e:\python\python\python.exe, e:\python\python\lib\site-packages\wfastcgi.py'
. )
An error occurred running the command:
['C:\\WINDOWS\\system32\\inetsrv\\appcmd.exe', 'set', 'config', '/section:system.webServer/fastCGI', "/+[fullPath='e:\\python\\python\\python.exe', arguments='e:\\python\\python\\lib\\site-packages\\wfastcgi.py', signalBeforeTerminateSeconds='30']"]
Ensure your user has sufficient privileges and try again.
可能是之前启用的没有禁用,可以先禁用再启用试试。
wfastcgi-disable
wfastcgi-enable
如果还是不行,可以检查IIS中的FastCGI设置是否正确。
之后检查自己的web.config,在自己的网站根目录下。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="<Path to Python>\python.exe|<Path to Python>\lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script"/>
</handlers>
</system.webServer>
</configuration>
'Path to Python’这里填写脚本解析器(python.exe)和wfastcgi.py的绝对路径 【解析器路径可以用python安装目录下的python.exe 也可以用python虚拟环境的python.exe,根据自己的情况选择即可】。
如何配置IIS 可以参考文章
https://blog.youkuaiyun.com/bigcarp/article/details/121028820