HTTP Error 500.0 - INTERNAL SERVER ERROR for Azure Flask Celery Web App RRS feed

  • Question

  • I deployed a flask app that uses celery on Azure but it's getting HTTP Error 500.0 - INTERNAL SERVER ERROR. Based on the error message, it looks like this is because my web.config file. Does anyone know how to modify the web.config file to fix this? The app functions locally and I already set up Azure redis and a web job that's functioning so it shouldn't be a problem with redis. WSGI log also doesn't show any error.

    Here's my web.config

    <?xml version="1.0" encoding="utf-8"?>
        <add key="WSGI_HANDLER" value="app.app"/>
        <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
        <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
          <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\Python364x64\python.exe|D:\home\Python364x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>


    Missed another error: HTTP Error 404.3 - Not Found.

    The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

    Most likely causes:
    It is possible that a handler mapping is missing. By default, the static file handler processes all content.
    The feature you are trying to use may not be installed.
    The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
    If ASP.NET is not installed.

    Things you can try:
    In system.webServer/handlers:
    Ensure that the expected handler for the current page is mapped.
    Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool.
    Pay extra attention to typographical errors in the expected handler line.
    Please verify that the feature you are trying to use is installed.
    Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe.
    To set a MIME type, use the following syntax: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']
    The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.
    For example, to add a MIME map for a file which has the extension ".xyz": appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']
    Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them.
    Install ASP.NET.
    Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

    I think this has to do with the fact that I'm returning a json in the route longtask for progress bar or handler mapping is not done properly, any idea how to configure this?

    @app.route('/longtask', methods=['POST'])
    def longtask():
        if request.method == 'POST':
            task = long_task.delay(request.form.get('text'))
        return jsonify({}), 202, {'Location': url_for('taskstatus',task_id=task.id)}

    • Edited by 13a Tuesday, August 13, 2019 8:07 PM
    Tuesday, August 13, 2019 6:15 PM

All replies

  • Hi,

    Thanks for raising the issue. I am investigating the issue and will post the update here.

    Friday, August 16, 2019 4:49 AM
  • Could you please send an email to AzCommunity[at]Microsoft[dot]com referencing this thread, we would like to work closer with you on this matter
    Monday, August 19, 2019 4:23 AM