How To Host Streamlit App In Windows IIS?

Seeking guidance on hosting a Streamlit app in Windows IIS. Anyone experienced with this? Looking for step-by-step instructions or helpful tips to ensure a smooth setup. Thanks in advance for your insights!

I use IIS with my streamlit apps.

I have a windows server where I run my streamlit apps using batch files and task scheduler to run the batch files once a day and ensure they are still running each day. This works great for me and I am able to access each app on localhost:port on the server but also from any devices that have access to the server at the network url that pops up after streamlit run app.py.

Here is where I use IIS:

  1. Before running the app like above, I add the folder where the app lives to an IIS site I have created.
  2. After adding the app I use the url rewrite in IIS to add a reverse proxy to the app so that if someone wants to access it at the network url they can go to 1.1.1.1/app_name/ instead of 1.1.1.1:8501.

I am planning to add https support to get rid of the server ip but haven’t made it that far yet. I have used these as references:

IIS Reverse Proxy and Windows Authentication for Streamlit · GitHub
Configure Python web apps for IIS - Visual Studio (Windows) | Microsoft Learn

Hope this helps

Thank You For The Help.Really appreciated.
But The Problem With My Case Is I Am Using Streamlit Inside A Django File. I Succesfully Hosted Django Website In IIS. Now The Issue Is I Have Private Network Cannot Access The IP Directly. So I Want A Solution That Works With My Problem.

Gotcha, I’m interested in how you are using the django website and streamlit apps. Are you iframing them into different pages on the django website?

Also what do you mean by private network cannot access the ip directly?

Exactly I Am Using Streamlit Using Iframe.by private network I meant that I have hosted my django app in vm instances of azure. Which is outside of my company’s network.they do not allow to access my this via instance internal IP.I have already hosted one site on IIS which is django s can we host Streamlit directly in this site by creating sub folder? Or anything else.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="F:\Jay\Deployment\Deployment\Scripts\streamlit.exe"
                  arguments="activate"
                  stdoutLogEnabled="true"
                  stdoutLogFile="F:\Jay\Deployment\CDE\STM\LogFile\"
                  startupTimeLimit="60"
                  processesPerApplication="16">
      <environmentVariables>
        <!-- <environmentVariable name="SERVER_PORT" value="8502" /> -->
      </environmentVariables>
    </httpPlatform>
  </system.webServer>
</configuration>

I Tried Above Code But In Log File I am Getting

  Welcome to Streamlit!

  If you’d like to receive helpful onboarding emails, news, offers, promotions,
  and the occasional swag, please enter your email address below. Otherwise,
  leave this field blank.

  Email: 2024-02-28 12:30:52.259 input(): lost sys.stdin

@28bwainwright - thanks for this…very helpful. any chance you could post the handlers/httpPlatform section of your web.config file? I can’t quite seem to get that right…

I have since switched over to linux to run streamlit apps in docker with nginx as a reverse proxy. My company made the decision because it seems like streamlit plays nicer on linux than with windows. So I dont think I will be much more help