Search code examples
azuref#self-hostingsuave

Access Suave self hosted app in Azure VM from internet


I deployed a Suave selfhosted webapp that is accessible from http://localhost:9001 inside an Azure VM Windows Server 2012 R2 Datacenter and am trying to make it accessible from outside the VM on http://[my-vm-name].cloudapp.net:9001.

It is a simple Hello world:

[<EntryPoint>] 
let main args = 
    startWebServer { defaultConfig with bindings = [ Types.HttpBinding.mk' Types.HTTP "127.0.0.1" 9001 ] } (OK "Hello world")
    0

localhost accessible

I already have:

  1. Set up the inbounds and outbounds rules for port 9001 on the VM firewall enter image description here enter image description here
  2. Added 9001 TCP and UDP endpoints on Azure portal

azure portal endpoints

All the solutions/tutorials I find don't specify more details than what I already did but I still can't access my webapp from outside the VM. What else am I missing?


Solution

  • You didn't specify what technology you are using to build your app but in many cases there are options to specify which addresses to bind to. Make sure you are actually binding to all addresses / interfaces and not just to localhost.