Sha*_*rak 6 windows iis web-deployment server fastapi
我有一个 FastAPI Web 应用程序,正在尝试将其部署在 Windows Server 2019 上的 IIS 版本 10.0.* 上。
现在,我可以在本地运行该应用程序,没有任何问题,您可以在这里找到存储库: https: //github.com/shaybarak11/Twitter-API
为了在本地运行它,我正在做的是通过 CMD 运行应用程序:
python main.py
在 main.py 文件中,我有这行启动应用程序的代码:
uvicorn.run("main:app", host="0.0.0.0", port=8000, log_level="info")
现在,我尝试在 IIS 上部署这个应用程序。这些是我到目前为止所采取的步骤:
我的 web.config 文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe"
arguments="C:\Users\Administrator\Desktop\Twitter-API\main.py"
stdoutLogEnabled="true"
stdoutLogFile="c:\home\LogFiles\python.log"
startupTimeLimit="60"
processesPerApplication="16">
<environmentVariables>
<environmentVariable name="USERNAME" value="root" />
<environmentVariable name="PASSWORD" value="password" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
有人知道错误是什么吗?
非常感谢,
谢伊。