using System; using System.ServiceModel; using System.Web.Routing; using System.ServiceModel.Activation; using System.ServiceModel.Web; using Nancy.Hosting.Wcf; using Sony.Filtr.API.WCF; namespace Sony.Filtr.API { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add(new Route("Proxy", new GenericRouteHandler())); var filtrHostFactory = new FiltrServiceServiceHostFactory(); RouteTable.Routes.Add(new ServiceRoute("v4", new NancyServiceHostFactory(), typeof(NancyWcfGenericService))); //With Deezer-support: RouteTable.Routes.Add(new ServiceRoute("3.0", filtrHostFactory, typeof(FiltrApi3))); RouteTable.Routes.Add(new ServiceRoute("workout/3.0", filtrHostFactory, typeof(FiltrApiWorkout3))); //Legacy: //RouteTable.Routes.Add(new ServiceRoute("workout/2.1", filtrHostFactory, typeof(FiltrApiWorkout))); //RouteTable.Routes.Add(new ServiceRoute("2.1", filtrHostFactory, typeof(FiltrAPI21))); //RouteTable.Routes.Add(new ServiceRoute("2.0", filtrHostFactory, typeof(FiltrAPI2))); //RouteTable.Routes.Add(new ServiceRoute("1.0", webServiceHostFactory, typeof(FiltrAPI))); //RouteTable.Routes.Add(new ServiceRoute("", webServiceHostFactory, typeof(FiltrAPI))); } } public class NancyServiceHostFactory : ServiceHostFactory { protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { var serviceHost = new WebServiceHost(new NancyWcfGenericService(), baseAddresses); return serviceHost; } } }