Python FastCGI error on Microsoft Azure
<p>Trying to deploy Python app on Azure Cloud. Created WebApp from Cookiecutter <a href="https://github.com/brettcannon/python-azure-web-app-cookiecutter" rel="nofollow noreferrer">template</a> with python3.5.2x64. Using preconfigured <code>web.config</code> from the template I am faced with 500 error:<br>
<code>&lt;handler&gt; scriptProcessor could not be found in &lt;fastCGI&gt; application configuration</code>.</p>

<p>My <code>web.config</code> file:</p>

<pre><code>&lt;configuration&gt;
 &lt;system.web&gt;
    &lt;customErrors mode="Off"/&gt;
 &lt;/system.web&gt;
 &lt;appSettings&gt;
  &lt;add key="PYTHONPATH" value="D:\home\site\wwwroot"/&gt;
  &lt;add key="WSGI_HANDLER" value="webapp.wsgi_app"/&gt;
  &lt;add key="WSGI_LOG" value="D:\home\LogFiles\python.log"/&gt;
 &lt;/appSettings&gt;
 &lt;system.webServer&gt;
  &lt;httpErrors errorMode="Detailed" /&gt;
  &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  &lt;handlers&gt;
   &lt;add name="Python FastCGI"
       path="*"
       verb="*"
       modules="FastCgiModule"        
       scriptProcessor="D:\home\Python35\python.exe|D:\home\Python35\wfastcgi.py"
       resourceType="Unspecified"
       requireAccess="Script" /&gt;
  &lt;/handlers&gt;
 &lt;/system.webServer&gt;
&lt;/configuration&gt;
</code></pre>

<p>My <code>webapp.py</code>:</p>

<pre><code>def wsgi_app(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    response_body = 'Hello World'
    yield response_body.encode()
if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    httpd = make_server('localhost', 5555, wsgi_app)
    httpd.serve_forever()
</code></pre>

<p>Using Django app from Azure doesn't help, because it's rather outdated (uses unsupported <code>Microsoft.Diagnostics</code>, raises <code>AttributeError: 'module' object has no attribute 'get_virtualenv_handler'</code>).</p>

<p>Any suggestions what I'm doing wrong? Thank you.</p>

<p><strong>Update</strong>. 
After some time spent I've found out that all works with the native installed Python (2 or 3, doesn't matter), thus it seems that IIS doesn't see or smth my Python Extension (installed from Azure Portal btw). Nevertheless, even with native Python it works not immediately, but at first throwing <code>TypeError: source code string cannot contain null bytes</code> (Python 3.4) or <code>AttributeError: 'module' object has no attribute 'wsgi_app'</code> (Python 2.7). And after about 15 minutes it <em>magically</em> starts working. All I was doing was changing <em>Hello World!</em> string.</p>