Skip to content

Instantly share code, notes, and snippets.

Created January 26, 2011 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arobson/797337 to your computer and use it in GitHub Desktop.
Save arobson/797337 to your computer and use it in GitHub Desktop.
A contrived but fun example of how to build a OWIN compliant file server using Symbiote.
using System;
using System.Collections.Generic;
using Symbiote.Core;
using Symbiote.Http;
using Symbiote.Http.Impl;
using Symbiote.Http.Owin;
using Symbiote.StructureMap;
using Symbiote.Daemon;
using Symbiote.Messaging;
using Symbiote.Actor;
namespace FileServerDemo
public class Program
static void Main(string[] args)
.Daemon(x => x.Arguments(args))
.HttpHost(x => x
.ConfigureHttpListener(l => l.AddPort(8989))
.RegisterApplications(a => a.DefineApplication<FileServer>(r => r.Url.StartsWith("/file")))
public class FileServer : IApplication
public void Process(IDictionary<string, object> requestItems, Action<string, IDictionary<string, IList<string>>, IEnumerable<object>> respond, Action<Exception> onException)
var request = requestItems.ExtractRequest();
.AppendFileContentToBody( request.Url )
.Submit( HttpStatus.Ok );
public class HostService : IDaemon
public IHost Host { get; set; }
public void Start()
public void Stop()
public HostService(IHost host)
Host = host;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment