Dash application in IIS freezes after "Loading..." is displayed

I have created a sample dash application that works fine from the command line and from //localhost:8050.
However when I try to run it from IIS the following is displayed:

image

the tab changes to the word “Dash” and the text “Loading…” is displayed. It looks like the application starts but never finishes.

What am I missing?

my app.py file is below

import dash
import dash_core_components as dcc
import dash_html_components as html
from flask import Flask

server = Flask(name)
app = dash.Dash(name,server=server)
#server = app.server
app.config[‘suppress_callback_exceptions’]=True

app.layout = html.Div(children=[
html.H1(children=‘Hello Dash’),

html.Div(children='''
    Dash: A web application framework for Python.
'''),

dcc.Graph(
    id='example-graph',
    figure={
        'data': [
            {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
            {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': 'Montreal'},
        ],
        'layout': {
            'title': 'Dash Data Visualization'
        }
    }
)

])

if name == ‘main’:
app.run_server(debug=False)

This code works fine from the command line.

the web.config file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\dev\Fast\logs\Fast.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
</appSettings>

I found another post that described using the browser console to see if something was logged there.
The console reported multiple entries with: “Failed to load resource: the server Dash…”

My assumption now is that there is a problem with my IIS configuration. (I am new to IIS as well as dash and python.)

I am using a virtual environment with all of my code in c:\dev\Fast\my_venv\Scripts directory.

perhaps the problem is in this part of my web.config file?

<appSettings>
    <add key="WSGI_HANDLER" value="app.server" />
    <add key="PYTHONPATH" value="C:\dev\Fast\my_venv\Scripts" />
<add key="SCRIPT_NAME" value="/dashboard" />

I found the fix in the reply from alexcjohnson in the following post

I added the the requests_pathname_prefix to the app=dash.Dash line in my python app.py code

app = dash.Dash(name,server=server,requests_pathname_prefix=‘/dashboard/’)

And now it works!!