Marcin Drobik

software journeyman notes

How to Host Katana on Azure?

Following steps worked for me, using Owin 2.1 and Azure SDK 2.3:

  1. Create "Windows Azure Cloud Service" Project with "Worker Role" added
  2. In created WorkerRole project, add NuGet package:

    Install-Package Microsoft.Owin.SelfHost
    
  3. Create following "Startup" class:

    public class Startup
    {
        public void Configuration(IAppBuilder appBuilder)
        {
            appBuilder.UseWelcomePage();
        }
    }
    
  4. In WorkerRole class, in Run() method, start use following code to start the server:

    using (WebApp.Start<Startup>("http://*:80"))
    {
        Trace.TraceInformation("Working");
        while (true)
        {
            Thread.Sleep(10000);
        }
    }
    
  5. Go to Worker Role properties (right-click the node under Cloud Services project, select Properties). On Endpoints tab, add new endpoint: Endpoints Configuration

  6. Add following line in Cloud Services project, in *.csdef file inside "WorkerRole" tag (this enables Worker Role to open listening port):

    <Runtime executionContext="elevated" />
    
  7. Deploy the Worker Role to Azure and Enjoy!

comments powered by Disqus