Python.exe - The Fastcgi Process Exited Unexpectedly
Solution 1:
You could follow the below steps to configure python flask application in iis:
1)First, you need to install the python,wfastcgi, and flask at your server.
You can download the python from below link:
https://www.python.org/downloads/
Note: if possible please use python version above 3.6.
2)after installing python install the wfastcgi. run the command prompt as administrator and run below command:
pip install wfastcgi
wfastcgi-enable
3)below is my flask example:
from flask importFlaskapp= Flask(__name__)
@app.route("/")
def hello():
return"Hello from FastCGI via IIS!"if__name__== "__main__":
app.run()
4)after creating an application to run it use below command:
python app.py
5)enable the cgi feature of iis:
6)open iis.
right-click on the server name and select add site.
enter the site name physical path and the site binding.
after adding site select the site name and select the handler mapping feature from the middle pane.
Click “Add Module Mapping”
executable path value:
C:\Python37-32\python.exe|C:\Python37-32\Lib\site-packages\wfastcgi.py
Click “Request Restrictions”. Make sure “Invoke handler only if the request is mapped to:” checkbox is unchecked:
Click “Yes” here:
7)now go back and select the application setting feature.
click add from the action pane.
Set the PYTHONPATH variable(which is your site folder path):
And the WSGI_HANDLER (my Flask app is named app.py so the value is app.app — if yours is named site.py it would be site.app or similar):
8)Click OK and browse to your site.
Note: Do not forget to assign the iis_iusrs and iusr permission to the site folder and the python folder.
Solution 2:
Check whether the production version of python and latest installed version of python in your machine, you have to install product version (version with in which you have developed your web app) and configure the fastcgi and handlers as it is.
Solution 3:
My issue was that I could run Flask app through cmd/PowerShell, but as soon as I ran it through IIS, it was returning above error with error code 0x00000067. I tried a lot of different things, including setting permissions etc. I finally solved it, by re-installing Python (3.9.6 in my case). I installed it for all users (via Advanced options), in folder C:\Python39 (I was careful not to put it in C:\Program Files, as some people reported issues with double quotes).
Post a Comment for "Python.exe - The Fastcgi Process Exited Unexpectedly"