See www.servicestack.net for an overview.
Join the ServiceStack Google+ Community or follow @ServiceStack for project updates. You can catch some community members hanging out on JabbR.
Service Stack is a high-performance .NET web services platform that simplifies the development of high-performance REST (JSON, XML, JSV, HTML, MsgPack, ProtoBuf, CSV) and WCF SOAP Web Services.
This example is also available as a stand-alone integration test:
//Web Service Host Configuration
public class AppHost : AppHostHttpListenerBase
{
public AppHost() : base("TODOs Tests", typeof(Todo).Assembly) {}
public override void Configure(Container container)
{
container.Register(new TodoRepository());
}
}
//REST Resource DTO
[Route("/todos")]
[Route("/todos/{Ids}")]
public class Todos : IReturn<List<Todo>>
{
public long[] Ids { get; set; }
public Todos(params long[] ids)
{
this.Ids = ids;
}
}
[Route("/todos", "POST")]
[Route("/todos/{Id}", "PUT")]
public class Todo : IReturn<Todo>
{
public long Id { get; set; }
public string Content { get; set; }
public int Order { get; set; }
public bool Done { get; set; }
}
public class TodosService : Service
{
public TodoRepository Repository { get; set; } //Injected by IOC
public object Get(Todos request)
{
return request.Ids.IsEmpty()
? Repository.GetAll()
: Repository.GetByIds(request.Ids);
}
public object Post(Todo todo)
{
return Repository.Store(todo);
}
public object Put(Todo todo)
{
return Repository.Store(todo);
}
public void Delete(Todos request)
{
Repository.DeleteByIds(request.Ids);
}
}
//no code-gen required, can re-use above DTO's
var restClient = new JsonServiceClient(BaseUri);
List<Todo> all = restClient.Get(new Todos()); // Count = 0
var todo = restClient.Post(
new Todo { Content = "New TODO", Order = 1 }); // todo.Id = 1
all = restClient.Get(new Todos()); // Count = 1
todo.Content = "Updated TODO";
todo = restClient.Put(todo); // todo.Content = Updated TODO
restClient.Delete(new Todos(todo.Id));
all = restClient.Get(new Todos()); // Count = 0
$.getJSON(baseUri, function(todos) {
alert(todos.length == 1);
});
Calling the TODO REST service from Dart JsonClient
var client = new JsonClient(baseUri);
client.todos()
.then((todos) => alert(todos.length == 1) );
That's all the application code required to create a simple REST web service.
If you have NuGet installed, the easiest way to get started is to install ServiceStack via NuGet:
ServiceStack binaries only: Minimal installation of ServiceStack containing only the core-binaries (.NET 3.5+)
ServiceStack with Razor Support: Create an empty ASP.NET Web or Console Application and (.NET 4.0+)
Commercial support will be available for ServiceStack, contact team@servicestack.net for details
The Definitive list of Example Projects, Use-Cases, Demos, Starter Templates
GitHub has disabled its download feature so currently NuGet is the best way to get ServiceStack published releases. For environments that don't have NuGet installed (e.g. OSX/Linux) you can still download the published binaries by extracting them from the published NuGet packages. The url to download a nuget package is:
http://packages.nuget.org/api/v1/package/{PackageName}/{Version}
So to get the core ServiceStack and ServiceStack.Text libs in OSX/Linux (or using gnu tools for Windows) you can just do:
wget -O ServiceStack http://packages.nuget.org/api/v1/package/ServiceStack/3.9.62
unzip ServiceStack 'lib/*'
wget -O ServiceStack.Text http://packages.nuget.org/api/v1/package/ServiceStack.Text/3.9.62
unzip ServiceStack.Text 'lib/*'
which will download and extract the dlls into your local local lib/
folder.
Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source. Alternative commercial licensing is also available, contact team@servicestack.net for details.
Commits should be made to the v3-fixes branch so they can be merged into both v3 and master (v4) release branches. Contributors need to approve the Contributor License Agreement before any code will be reviewed, see the Contributing wiki for more details.
ServiceStack includes source code of the great libraries below for some of its core functionality. Each library is released under its respective licence:
- Mono (License)
- Funq IOC (License)
- Fluent Validation (License)
- Mini Profiler (License)
- Dapper (License)
- TweetStation's OAuth library (License)
- MarkdownSharp (License)
- MarkdownDeep (License)
Similar Open source .NET projects for developing or accessing web services include:
- Nancy Fx - A Sinatra-inspired lightweight Web Framework for .NET:
- Fubu MVC - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET:
- Rest Sharp - An open source REST client for .NET
Follow @ServiceStack and +ServiceStack for project updates.
A big thanks to GitHub and all of ServiceStack's contributors:
- bman654 (Brandon Wallace)
- iristyle (Ethan Brown)
- superlogical (Jake Scott)
- itamar82
- chadwackerman
- derfsplat
- johnacarruthers (John Carruthers)
- mvitorino (Miguel Vitorino)
- bsiegel (Brandon Siegel)
- mdavid (M. David Peterson)
- lhaussknecht (Louis Haussknecht)
- grendello (Marek Habersack)
- SteveDunn (Steve Dunn)
- kcherenkov (Konstantin Cherenkov)
- timryan (Tim Ryan)
- letssellsomebananas (Tymek Majewski)
- danbarua (Dan Barua)
- JonCanning (Jon Canning)
- paegun (James Gorlick)
- pvasek (pvasek)
- derfsplat (derfsplat)
- justinrolston (Justin Rolston)
- danmiser (Dan Miser)
- danatkinson (Dan Atkinson)
- brainless83 (Thomas Grassauer)
- angelcolmenares (angel colmenares)
- dbeattie71 (Derek Beattie)
- danielwertheim (Daniel Wertheim)
- greghroberts (Gregh Roberts)
- int03 (Selim Selçuk)
- andidog (AndiDog)
- chuckb (chuckb)
- niemyjski (Blake Niemyjski)
- mj1856 (Matt Johnson)
- matthieugd (Matthieu)
- tomaszkubacki (Tomasz Kubacki)
- e11137 (Rogelio Canedo)
- davidroth (David Roth)
- meebey (Mirco Bauer)
- codedemonuk (Pervez Choudhury)
- jrosskopf (Joachim Rosskopf)
- friism (Michael Friis)
- mp3125
- aurimas86
- parnham (Dan Parnham)
- yeurch (Richard Fawcett)
- damianh (Damian Hickey)
- freeman (Michel Rasschaert)
- kvervo (Kvervo)
- pauldbau (Paul Du Bois)
- justinpihony (Justin Pihony)
- bokmadsen (Bo Kingo Damgaard)
- dragan (Dale Ragan)
- sneal (Shawn Neal)
- johnsheehan (John Sheehan)
- jschlicht (Jared Schlicht)
- kumarnitin (Nitin Kumar)
- davidchristiansen (David Christiansen)
- paulecoyote (Paul Evans)
- kongo2002 (Gregor Uhlenheuer)
- brannonking (Brannon King)
- alexandrerocco (Alexandre Rocco)
- cbarbara
- assaframan (Assaf Raman)
- csakshaug (Christian Sakshaug)
- johnman
- jarroda
- ssboisen (Simon Skov Boisen)
- paulduran (Paul Duran)
- pruiz (Pablo Ruiz García)
- fantasticjamieburns
- pseabury
- kevingessner (Kevin Gessner)
- iskomorokh (Igor Skomorokh)
- royjacobs (Roy Jacobs)
- robertmircea (Robert Mircea)
- markswiatek (Mark Swiatek)
- flq (Frank Quednau)
- ashd (Ash D)
- thanhhh
- algra (Alexey Gravanov)
- jimschubert (Jim Schubert)
- gkathire
- mikaelwaltersson (Mikael Waltersson)
- asunar (Alper)
- chucksavage (Chuck Savage)
- sashagit (Sasha)
- froyke (Froyke)
- dbhobbs (Daniel Hobbs)
- bculberson (Brad Culberson)
- awr (Andrew)
- pingvinen (Patrick)
- citndev (Sebastien Curutchet)
- cyberprune
- jorbor (Jordan Hayashi)
- bojanv55
- i-e-b (Iain Ballard)
- pietervp (Pieter Van Parys)
- franklinwise
- ckasabula (Chuck Kasabula)
- dortzur (Dor Tzur)
- allenarthurgay (Allen Gay)
- viceberg
- vansha (Ivan Korneliuk)
- aaronlerch (Aaron Lerch)
- glikoz
- danielcrenna (Daniel Crenna)
- stevegraygh (Steve Graygh)
- jrmitch120 (Jeff Mitchell)
- manuelnelson (Manuel Nelson)
- babcca (Petr Babicka)
- jgeurts (Jim Geurts)
- driis (Dennis Riis)
- gshackles (Greg Shackles)
- jsonmez (John Sonmez)
- dchurchland (David Churchland)
- softwx (Steve Hatchett)
- ggeurts (Gerke Geurts)
- andrewrissing (Andrew Rissing)
- jjavery (James Javery)
- suremaker (Wojtek)
- cheesebaron (Tomasz Cielecki)
- mikkelfish (Mikkel Fishman)
- johngibb (John Gibb)
- stabbylambda (David Stone)
- mikepugh (Mike Pugh)
- permalmberg (Per Malmberg)
- adamralph (Adam Ralph)
- shamsulamry (Shamsul Amry)
- peterlazzarino (Peter Lazzarino)
- kevin-montrose (Kevin Montrose)
- msarchet (Michael Sarchet)
- jeffgabhart (Jeff Gabhart)
- pkudinov (Pavel Kudinov)
- permalmberg (Per Malmberg)
- namman (Nick Miller)
- leon-andria (Leon Andria)
- kkolstad (Kenneth Kolstad)
- electricshaman (Jeff Smith)
- ecgan (Gan Eng Chin)
- its-tyson (Tyson Stolarski)
- tischlda (David Tischler)
- connectassist (Carl Healy)
- starteleport
- jfoshee (Jacob Foshee)
- nardin (Mamaev Michail)
- cliffstill
- somya (Somya Jain)
- thinkbeforecoding (Jérémie Chassaing)
- paksys (Khalil Ahmad)
- mcguinness (Karl McGuinness)
- jpasichnyk (Jesse Pasichnyk)
- waynebrantley (Wayne Brantley)
- dcartoon (Dan Cartoon)
- alexvodovoz (Alex Vodovoz)
- jluchiji (Denis Luchkin-Zhou)
- grexican
- akoslukacs (Ákos Lukács)
- medianick (Nick Jones)
- arhoads76
- dylanvdmerwe (Dylan v.d Merwe)
- mattiasw2 (Mattias)
- paultyng (Paul Tyng)
- h2oman (Jason Waterman)
- anewton (Allen Newton)
- sami1971
- russellchadwick (Russell Chadwick)
- cyberzed (Stefan Daugaard Poulsen)
- filipw (Filip Wojcieszyn)
- ghuntley (Geoffrey Huntley)
- baramuse
- pdegenhardt (Phil Degenhardt)
- captncraig (Craig Peterson)
- abattery (Jae sung Chung)
- biliktamas79
- garuma (Jérémie Laval)
- dsimunic
- adamfowleruk (Adam Fowler)
- bfriesen (Brian Friesen)
- roryf (Rory Fitzpatrick)
- stefandevo
- gdassac
- metal10k
- cmelgarejo
- skaman
- rossipedia (Bryan J. Ross)
- wimatihomer (Wim Pool)
- sword-breaker
- adebisi-fa (Adebisi Foluso A.)
- mbischoff (M. Bischoff)
- ivanfioravanti (Ivan Fioravanti)
- inhibition (Keith Hassen)
- joshearl (Josh Earl)
- friism (Michael Friis)
- corkupine
- bchavez (Brian Chavez)
- nhhagen (Niels Henrik Hagen)
- daggmano (Darren Oster)
- chappoo (Steve Chapman)
- julrichkieffer (Julrich Kieffer)
- adamclarsen (Adam Larsen)
- joero74 (Joerg Rosenkranz)
- ddotlic (Drazen Dotlic)
- chrismcv (Chris McVittie)
- marcioalthmann (Márcio Fábio Althmann)
- mmertsock (Mike Mertsock)
- johnkamau (John Kamau)
- uhaciogullari (Ufuk Hacıoğulları)
- davybrion (Davy Brion)
- aleshi (Alexander Shiryaev)
- alexandryz (Alexandr Zaozerskiy)
- mistobaan (Fabrizio Milo)
- niemyjski (Blake Niemyjski)
- alexandernyquist (Alexander Nyquist)
- mcduck76
- kojoru
- jeremy-bridges (Jeremy Bridges)
- andreabalducci (Andrea Balducci)
- robertthegrey (Robert Greyling)
- robertbeal (Robert Beal)
- improvedk (Mark Rasmussen)
- foresterh (Jamie Houston)
- peterkahl (Peter Kahl)
- helgel
- anthonycarl (Anthony Carl)
- mrjul (Julien Lebosquain)
- pwhe23 (Paul Wheeler)
- aleksd
- miketrebilcock (Mike Trebilcock)
- markwoodhall (Mark Woodhall)
- theonlylawislove (Paul Knopf)
- callumvass (Callum Vass)
- bpruitt-goddard
- gregpakes (Greg Pakes)
- caspiancanuck (Caspian Canuck)
- merwer
- pavelsavara (Pavel Savara)
- markwalls (Mark Walls)
- prasannavl (Prasanna Loganathar)
- wilfrem
- emiba
- lucky-ly (Dmitry Svechnikov)
- hhandoko (Herdy Handoko)
- datawingsoftware
- tal952
- bretternst
- kevinhoward (Kevin Howard)
- mattbutton (Matt Button)
- torbenrahbekkoch (Torben Rahbek Koch)
- pilotmartin (Pilot Martin)
- catlion
- tstade (Toft Stade)
- niltz (Jeff Sawatzky)
- nhalm
- fhurta (Filip Hurta)
- discobanan
- x-cray
- jeremistadler (Jeremi Stadler)
- bangbite
- felipesabino (Felipe Sabino)
- xelom (Arıl Bozoluk)
- shiweichuan (Weichuan Shi)
- kojoru (Konstantin Yakushev)
- eddiegroves (Eddie Groves)
- fetters5
- rcollette (Richard Collette)
- urihendler (Uri Hendler)
- laurencee (Laurence Evans)
- m-andrew-albright (Andrew Albright)
- lee337 (Lee Venkatsamy)
- kaza
- mishfit
- rfvgyhn (Chris)
- caioproiete (Caio Proiete)
- sjuxax (Jeff Cook)
- madaleno (Luis Madaleno)
- yavosh (Yavor Shahpasov)
- fvoncina (Facundo Voncina)
- devrios (Dev Rios)
- bfkelsey (Ben Kelsey)
- maksimenko
- dixon (Jarrod Dixon)
- kal (Kal Ahmed)
- mhanney (Michael Hanney)
- bcms
- mgravell (Marc Gravell)
- lafama (Denis Ndwiga)
- jamesgroat (James Groat)
- jamesearl (James Cunningham)
- remkoboschker (Remko Boschker)
- shelakel
- schmidt4brains (Doug Schmidt)
- joplaal
- aifdsc (Stephan Desmoulin)
- nicklarsen (NickLarsen)
- connectassist (Carl Healy)
- et1975 (Eugene Tolmachev)
- barambani
- nhalm
Runs on both Mono and .NET (Live preview hosted on Mono / Ubuntu)