Flask app getting 0x8007000d error with IIS


I'm trying to get a very basic flask app to work on IIS 10 running on Windows Server 2019. I followed the HTTPPlatform Handler instructions from: https://docs.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2019

But I keep getting HTTP 500.19 errors with error code 0x8007000d. From googling, I suspect the problem is in my web.config, but I don't know what is wrong. The app works fine from the command line. This is my web.config:

<?xml version="1.0" encoding="utf-8"?>
      <add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    <httpPlatform processPath="D:\python39\python.exe"
        <environmentVariable name="SERVER_PORT" value="9010" />
This is my app.py:

from flask import Flask, render_template

app = Flask(__name__)
#app.debug = True

@app.route("/", methods=('GET', 'POST'))
def home():
  return render_template('main.html', hello = 'hello world')

if __name__ == '__main__':

this is my main.html

{% extends 'layout.html' %}
{% block content %}
  <div class="container">
    <div class="leftrow1">
      {{ hello }}
    <div class="leftrow2">
    <div class="leftrow3">
    <div class="leftrow4">

    <div class="main_frame_1">
    <div class="main_frame_2">
{% endblock content %}

and this is the layout.html

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>
  {% block content %} 
  {% endblock content %}
Update: based on comments received, adding additional error info This is the error I get (without installing httpplatformhandler), nothing is in eventlog when this occurs: 500.19 error message This is the error I get after installing httpplatformhandler: 500.3 error message with the 500.3 message, I also get a bunch of event 1000 from HttpPlatformHandler in event log: enter image description here

asked on Stack Overflow Nov 24, 2020 by Ching Liu • edited Nov 25, 2020 by Ching Liu

1 Answer


It seems that you don't have the correct permission to access D:\python39\python.exe and D:\inetpub\wwwroot\flasktest.py.

  1. Open IIS Manager -> Select the site you added the HttpPlatformHandler

  2. Click Handler Mappings in the feature view -> select the HttpPlatformHandler

  3. Click Edit Feature Permission in the Action Panel

  4. Make sure you have check the Execute permission

answered on Stack Overflow Nov 26, 2020 by samwu

User contributions licensed under CC BY-SA 3.0