Search code examples
pythonflaskiisfastcgiwindows-server

Flask Permission Error when deployed to IIS


I deployed a flask app to IIS using FastCGI and WSGI Handler. The steps that I have followed are

  1. Created a virtual environment for Python and installed all packages including wfastCGI.
  2. Set the Handler mappings and included the FastCGI settings.
  3. Assigned the necessary permissions for the folders by adding IIS_IUSRS and IUSR.

Below is the medium link that I followed in terms of the steps. https://medium.com/@dpralay07/deploy-a-python-flask-application-in-iis-server-and-run-on-machine-ip-address-ddb81df8edf3

The folder structure for the code is as shown below with (checkin_env) being the virtual environment.

FolderStructure

checkFlask

Fast CGI settings are shown as below with WSGI Handler being checkFlask.app

enter image description here

The web.config file which was generated is here. enter image description here

When I tried running on Ports 80, 5000 I received a permission error related to System32 which I am totally confused and unsure about. Any thoughts or inputs are highly appreciated. Thank you.

Error Received


Solution

  • The issue was with some libraries inside the checkFlask.py file which included IPython.display. Code worked fine after removing those libraries. Marking this as resolved for now. Here is a reference link for the solution I found. https://community.esri.com/t5/python-questions/are-wfastcgi-python-api-compatible/m-p/76578#M6215