Skip to content

Instantly share code, notes, and snippets.

@mythz mythz/Global.asax
Created Sep 28, 2011

What would you like to do?
Hello World ServiceStack ASP.NET Web Service in F#
<%@ Application Inherits="HelloFSharp.Global" %>
(* Hello World ServiceStack ASP.NET Web Service in F#
1) download
2) fsharpc -r:ServiceStack.Common.dll -r:ServiceStack.Interfaces.dll -r:ServiceStack.Text.dll -r:ServiceStack.dll --target:library HelloAsp.fs
3) mkdir bin && cp *.dll bin
4) echo "<%@ Application Inherits=\"HelloFSharp.Global\" %>" >> Global.asax
5) copy Web.config mappings from
6) xsp4
namespace HelloFSharp
open System
open ServiceStack.ServiceHost
open ServiceStack.WebHost.Endpoints
type Hello = { mutable Name: string; }
type HelloResponse = { mutable Result: string; }
type HelloService() =
interface IService<Hello> with
member this.Execute (req:Hello) = { HelloResponse.Result = "Hello, " + req.Name } :> Object
//Define the Web Services AppHost
type AppHost =
inherit AppHostBase
new() = { inherit AppHostBase("Hello F# Services", typeof<HelloService>.Assembly) }
override this.Configure container =
.Add<Hello>("/hello/{Name}") |> ignore
type Global =
inherit System.Web.HttpApplication
new() = { }
member x.Application_Start() =
let appHost = new AppHost()
<?xml version="1.0"?>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
<!-- Required for IIS 7.0 -->
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.