Simplest way to deploy a streamlit app in Windows server 2012

How can an Streamlit app be deployed in windows server to share it with other users?
Can we deploy Streamlit app using a windows service?

I also want to publish the app to my windows2012 server.
Because our data is internal confidential data of the enterprise, it cannot be published to internet web service providers. But we have our own internal server, what kind of environment the server needs to be configured to run this.

1 Like

Hi @abhunia and hi @hillstone, thanks for posting. You can definitely host on a Windows machine and it is totally up to you which technology stack you want to use to expose the internal IP to your organization or to the internet. As for running, we recommend this flow.


Here is the way I deploy the website in the company network using the windows server 2012. It spends me a few days to figure out how to use that. It is quite easy to use the Windows IIS server to deploy the website. However, it is really hard to find a step by step way online for the windows server deployment. Hope it helpful for the people who also want to use the windows server 2012 to deploy the streamlit.

  1. First of all, create a virtual env and make sure your stream app can be run in the virtual env without issue.
  2. Second, open the Server Manager in the window server 2012, under the manage, click the Add Roles and Features
  3. Third, Make sure that you click Web Server (IIS), under the Application Development, make sure you click the CGI
  4. Next, Open Internet Information Server and create a new site. You need to include root app files into the new site. For my case, I call it testops
  5. Finally, click the Add Script Map… and fille the request path as *.py so that it will recognize your stream app script and select where your install the stream virtual. For the name, you can type whatever you like to call it.

Open a web browser and use the IP address that streamlit provides for the network URL use.


hi ethan.qiujian, thanks for the instruction. i followed your steps carefully but it looks like your solution does not work for me. is there something missing?

my application runs with powershell streamlit run --server.port=8501 in the webbrowser. but i am not able to see any streamlit app when i use your Windows Server Manager “handler mapping and add script map method” unfortunately.

do you have any updates or problems you had to deal with?

Hi guys,

I am also curious to find a tutorial which explains how to deploy streamlit apps on IIS. Has anyone had success with this issue?


1 Like

Hi ethan.qiujian,

I wasn’t able to really get this work; wondering how did you set up the toml file to skip email input and make streamlit work as a website? Do you mind adding a bit more details? Thanks.

Has anyone successfully deploy app on Windows server 2012?
Tried a lot but still can’t make it work
Thanks in advance if anyone can share some lights on this topic

Hi @ethan.qiujian

I followed your step by step tips and still couldn’t get the streamlit to open on IIS.

Am I missing something ?

For those following ethan’s step and still having errors, I have some solutions that worked for me.

  1. I skipped IIS and used task scheduler instead
    How to deploy Streamlit on Windows IIS? - #3 by johnnybarrels

  2. If you’re still having error, most likely the port is closed by windows firewall. Here’s how to open it
    Streamlit not getting AWS public IP - #3 by Steve_Chen

  3. If you’re on AWS EC2, there’s an extra step to open the port
    App is not loading when running remotely - Streamlit Docs

That’s it. That’s how I can run streamlit on Windows Server

We deploy streamlit as a Windows service and restart it with Jenkins. Download nssm 2.24-101 (for Win10), run cmd or powershell as administrator and run the following script. Nssm can install your pthon program entry as a Windows service. It can also start/stop this service as a service manager. The relevant example:

# Streamlit.exe location
C:/.../nssm.exe install StreamlitService "C:\...\Scripts\streamlit.exe"
# Streamlit entry script
C:/.../nssm.exe set StreamlitService AppParameters "run C:\...\1_🔒"
# Project home directory
C:/.../nssm.exe set StreamlitService AppDirectory "C:\...\streamlit-project"
# Set PYTHONPATH if necessary
C:/.../nssm.exe set StreamlitService AppEnvironmentExtra "PYTHONPATH=%PYTHONPATH%;C:\...\streamlit-project"
# Set log location
C:/.../nssm.exe set StreamlitService AppStdout "C:\...\StreamlitService.log"
C:/.../nssm.exe set StreamlitService AppStderr "C:\...\StreamlitService.log"
# Run service as log on user if necessary. USERNAME is your log on user
C:/.../nssm.exe set StreamlitService ObjectName ".\USERNAME" "PASSWORD"
# See GUI result
C:/.../nssm.exe edit StreamlitService
# Start service 
C:/.../nssm.exe start StreamlitService
# Stop service
C:/.../nssm.exe stop StreamlitService
# Restart service
C:/.../nssm.exe restart StreamlitService

This was super helpful, thank you!
One note, in AppParameters I had to only specify “run”, my start page was in the folder specified in AppDirectory.