CSharpRocky
CSharpRocky

Reputation: 19

Deploy flask api on IIS server gives error 0x8007010b notification: ExecuteRequestHandler

I have to deploy flask app on IIS server. configured the handler settings and also configured the fastcgi module settings for IIS server as given in the following tutorial https://medium.com/@rajesh.r6r/deploying-a-python-flask-rest-api-on-iis-d8d9ebf886e9 and https://medium.com/@bilalbayasut/deploying-python-web-app-flask-in-windows-server-iis-using-fastcgi-6c1873ae0ad8 I configured all the settings except url rewrite settings. I don't know how to configure it. When I run the flask app through python IDLE it runs fine and app url is accessible through browser. But IIS gives the following errors

    Module     FastCgiModule
    Notification       ExecuteRequestHandler
    Handler    pythonHandler
    Error Code     0x8007010b

I tried changing feature permissions but it gives error notifications like MapRequestHandler and ExecuteRequestHandler error codes:

    0x80070005, 0x80070002, 0x8007010b. 

Something from the trace log is as follows:

   <failedRequest url="http://localhost:5000/"
           siteId="5"
           appPoolId="tes_flask"
           processId="20452"
           verb="GET"
           remoteUserName=""
           userName=""
           tokenUserName="NT AUTHORITY\IUSR"
           authenticationType="anonymous"
           activityId="{80000887-0001-F800-B63F-84710C7967BB}"
           failureReason="STATUS_CODE"
           statusCode="500"
           triggerStatusCode="500"
           timeTaken="0"
           xmlns:freb="http://schemas.microsoft.com/win/2006/06/iis/freb"
           > 

Upvotes: 1

Views: 3228

Answers (4)

smoothumut
smoothumut

Reputation: 3491

for my case, I had to give full permissions IIS_IUSRS user on environment folder. I am using miniconda, so I had to go to miniconda3/envs folder and give that full permission with IIS_IUSRS to the xyz environment folder. I guess it worked in my case because, my python exe and wfastcgi.py files are all in this folder which my handler mappings check

Upvotes: 0

Ivan Kanchev
Ivan Kanchev

Reputation: 33

For some reason i cannot comment under the posts. However the post of Andrea pointer me to the issue. I opened the python.exe path, in my case: c:\Users<username>\AppData\Local\Programs\Python\Python310

i executed the following commands: icacls . /grant "NT AUTHORITY\IUSR:(OI)(CI)(RX)" icacls . /grant "Builtin\IIS_IUSRS:(OI)(CI)(RX)"

After that i was able to open the Flask app through IIS.

Upvotes: 0

Andrea
Andrea

Reputation: 4473

In order to solve this issue I had to grant Modify and Write permissions to the python.exe for the IUSR user.

Upvotes: 0

Bruce Zhang
Bruce Zhang

Reputation: 3042

I think this is probably a permission issue. Because 0x8007010b means The directory name is invalid.

  1. Ensure that the identity of the application pool has administrator rights. You can create a user with administrator rights or directly set it as a local system.
  2. Ensure that the application and FastCgiModule directories have read and write permissions.

Upvotes: 1

Related Questions