
pip install wfastcgi
首先以管理员身份运行wfastcgi-enable来在IIS上启用wfastcgi,这个命令位于c:\python_dir\scripts,也就是你需要确保此目录在系统的PATH里,或者你需要cd到这个目录后再执行。
# cd to python_dir\scripts if it is not in PATH
wfastcgi-enable
记住命令执行成功后返回的信息:
C:\Python34\Scripts> wfastcgi-enable
Applied configuration changes to section “system.webServer/fastCgi” for “MACHINE/WEBROOT/APPHOST” at configuration commit path “MACHINE/WEBROOT/APPHOST”
“C:\Python34\python.exe|C:\Python34\lib\site-packages\wfastcgi.py” can now be used as a FastCGI script processor
“C:Python34python.exe|C:Python34libsite-packageswfastcgi.py” 在下文的配置文件中需要使用。
Tips: 使用命令 wfastcgi-disable 可以将其移除。
下面是一个web.config文件的例子,你只需要修改对应部分就可以使用。
<configuration>
<system.webServer>
<handlers>
<add name="FlaskFastCGI" path="*" verb="*" modules="FastCgiModule"
scriptProcessor="C:\Python34\python.exe|C:\Python34\lib\site-packages\wfastcgi.py"
resourceType="Unspecified" requireAccess="Script" />
handlers>
<security>
<requestFiltering allowDoubleEscaping="true">requestFiltering>
security>
system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="hello.app" />
<add key="PYTHONPATH" value="~/" />
<add key="WSGI_LOG" value="C:\logs\oboeqa_web.log" />
<add key="WSGI_RESTART_FILE_REGEX" value="" />
appSettings>
configuration>
添加映射模块
选择站点下的映射模块


模块必须选择FastCgiModule
可执行程序选择wfastcgi-enable输出的路径

去掉映射下的复选框
保存后会在web.config中增加一条新的handlers记录,把原来的删掉就可以
注意事项:
在II8.0及以上版本会出现权限问题,需要修改应用程序池的标识为 localSystem
