Skip to content Skip to sidebar Skip to footer

Python.exe - The Fastcgi Process Exited Unexpectedly

I have read all posts about this issue, here and on IIS forum, got it to the second page on Google too... and still can't get it to work. I want to run Flask/Python app in IIS on W

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:

enter image description here

6)open iis.

right-click on the server name and select add site.

enter image description here

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.

enter image description here

Click “Add Module Mapping”

enter image description here

executable path value:

C:\Python37-32\python.exe|C:\Python37-32\Lib\site-packages\wfastcgi.py

enter image description here

Click “Request Restrictions”. Make sure “Invoke handler only if the request is mapped to:” checkbox is unchecked:

enter image description here

Click “Yes” here:

enter image description here

7)now go back and select the application setting feature.

enter image description here

click add from the action pane.

enter image description here

Set the PYTHONPATH variable(which is your site folder path):

enter image description here

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):

enter image description here

8)Click OK and browse to your site.

enter image description here

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"