I have a FastAPI web app that I'm trying to deploy on IIS version 10.0.* on Windows server 2019.
Right now, I can run the application locally with no issues, you can find the repository here: https://github.com/shaybarak11/Twitter-API
What I'm doing in order to run it locally is running the application via the CMD:
python main.py
And in the main.py file, I have this line of code that start the app:
uvicorn.run("main:app", host="0.0.0.0", port=8000, log_level="info")
So now, I'm trying to deploy this app on IIS. These are the steps I took so far:
- downloaded IIS on the Windows server.
- hit add website on IIS Manager page.
- added the Physical path of the project directory.
- connected as the Administrator.
- Went to Handler Mappings and added the python interpreter.
- Following the guide of configuring the web.config file for python app, I get now HTTP error 500.19 - that indicates the problem is with my web.config file.
My web.config file:
<?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>
Does someone have any idea what the error is?
Many thanks,
Shay.