Skip to content

Commit 19cef7b

Browse files
committed
added the most basic, self-contained ServiceStack web service
1 parent d73297a commit 19cef7b

10 files changed

Lines changed: 419 additions & 0 deletions

src/ServiceStack.Examples.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Examples.Tests
1616
EndProject
1717
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Examples.Tests.Integration", "..\tests\ServiceStack.Examples.Tests.Integration\ServiceStack.Examples.Tests.Integration.csproj", "{21777EAF-74FD-4D0B-947A-C602D8D3EBBA}"
1818
EndProject
19+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Hello", "ServiceStack.Hello\ServiceStack.Hello.csproj", "{A8F9A08B-E704-4C77-939B-B56670A2A98D}"
20+
EndProject
1921
Global
2022
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2123
Debug|Any CPU = Debug|Any CPU
@@ -54,6 +56,10 @@ Global
5456
{21777EAF-74FD-4D0B-947A-C602D8D3EBBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
5557
{21777EAF-74FD-4D0B-947A-C602D8D3EBBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
5658
{21777EAF-74FD-4D0B-947A-C602D8D3EBBA}.Release|Any CPU.Build.0 = Release|Any CPU
59+
{A8F9A08B-E704-4C77-939B-B56670A2A98D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
60+
{A8F9A08B-E704-4C77-939B-B56670A2A98D}.Debug|Any CPU.Build.0 = Debug|Any CPU
61+
{A8F9A08B-E704-4C77-939B-B56670A2A98D}.Release|Any CPU.ActiveCfg = Release|Any CPU
62+
{A8F9A08B-E704-4C77-939B-B56670A2A98D}.Release|Any CPU.Build.0 = Release|Any CPU
5763
EndGlobalSection
5864
GlobalSection(SolutionProperties) = preSolution
5965
HideSolutionNode = FALSE
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ServiceStack.Hello._Default" %>
2+
3+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
5+
<html xmlns="http://www.w3.org/1999/xhtml" >
6+
<head runat="server">
7+
<title>ServiceStack.Hello :: The smallest ServiceStack Web Service</title>
8+
</head>
9+
<body>
10+
<h1>Anatomy of a ServiceStack Web Service</h1>
11+
12+
<p>
13+
To help
14+
</p>
15+
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.UI;
6+
using System.Web.UI.WebControls;
7+
8+
namespace ServiceStack.Hello
9+
{
10+
public partial class _Default : System.Web.UI.Page
11+
{
12+
protected void Page_Load(object sender, EventArgs e)
13+
{
14+
15+
}
16+
}
17+
}

src/ServiceStack.Hello/Default.aspx.designer.cs

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceStack.Hello/Global.asax

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="ServiceStack.Hello.Global" Language="C#" %>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Runtime.Serialization;
3+
using Funq;
4+
using ServiceStack.ServiceHost;
5+
using ServiceStack.WebHost.Endpoints;
6+
7+
namespace ServiceStack.Hello
8+
{
9+
[DataContract]
10+
[RestService("/hello/{Name}")]
11+
public class Hello
12+
{
13+
[DataMember]
14+
public string Name { get; set; }
15+
}
16+
17+
[DataContract]
18+
public class HelloResponse
19+
{
20+
[DataMember]
21+
public string Result { get; set; }
22+
}
23+
24+
public class HelloService : IService<Hello>
25+
{
26+
public object Execute(Hello request)
27+
{
28+
return new HelloResponse { Result = "Hello, " + request.Name };
29+
}
30+
}
31+
32+
public class Global : System.Web.HttpApplication
33+
{
34+
public class HelloAppHost : AppHostBase
35+
{
36+
public HelloAppHost() : base("Hello Web Services", typeof(HelloService).Assembly) { }
37+
public override void Configure(Container container) { }
38+
}
39+
40+
protected void Application_Start(object sender, EventArgs e)
41+
{
42+
var appHost = new HelloAppHost();
43+
appHost.Init();
44+
}
45+
}
46+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("ServiceStack.Hello")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("ServiceStack.Hello")]
13+
[assembly: AssemblyCopyright("Copyright © 2010")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5+
<ProductVersion>9.0.30729</ProductVersion>
6+
<SchemaVersion>2.0</SchemaVersion>
7+
<ProjectGuid>{A8F9A08B-E704-4C77-939B-B56670A2A98D}</ProjectGuid>
8+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>ServiceStack.Hello</RootNamespace>
12+
<AssemblyName>ServiceStack.Hello</AssemblyName>
13+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="ServiceStack, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
34+
<SpecificVersion>False</SpecificVersion>
35+
<HintPath>..\..\libs\ServiceStack.dll</HintPath>
36+
</Reference>
37+
<Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>..\..\libs\ServiceStack.Interfaces.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Core">
44+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
45+
</Reference>
46+
<Reference Include="System.Data.DataSetExtensions">
47+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
48+
</Reference>
49+
<Reference Include="System.Runtime.Serialization">
50+
<RequiredTargetFramework>3.0</RequiredTargetFramework>
51+
</Reference>
52+
<Reference Include="System.Web.Extensions">
53+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
54+
</Reference>
55+
<Reference Include="System.Xml.Linq">
56+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
57+
</Reference>
58+
<Reference Include="System.Drawing" />
59+
<Reference Include="System.Web" />
60+
<Reference Include="System.Xml" />
61+
<Reference Include="System.Configuration" />
62+
<Reference Include="System.Web.Services" />
63+
<Reference Include="System.EnterpriseServices" />
64+
<Reference Include="System.Web.Mobile" />
65+
</ItemGroup>
66+
<ItemGroup>
67+
<Content Include="Default.aspx" />
68+
<Content Include="Global.asax" />
69+
<Content Include="Web.config" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<Compile Include="Default.aspx.cs">
73+
<SubType>ASPXCodeBehind</SubType>
74+
<DependentUpon>Default.aspx</DependentUpon>
75+
</Compile>
76+
<Compile Include="Default.aspx.designer.cs">
77+
<DependentUpon>Default.aspx</DependentUpon>
78+
</Compile>
79+
<Compile Include="Global.asax.cs">
80+
<DependentUpon>Global.asax</DependentUpon>
81+
</Compile>
82+
<Compile Include="Properties\AssemblyInfo.cs" />
83+
</ItemGroup>
84+
<ItemGroup>
85+
<Folder Include="App_Data\" />
86+
</ItemGroup>
87+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
88+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
89+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
90+
Other similar extension points exist, see Microsoft.Common.targets.
91+
<Target Name="BeforeBuild">
92+
</Target>
93+
<Target Name="AfterBuild">
94+
</Target>
95+
-->
96+
<ProjectExtensions>
97+
<VisualStudio>
98+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
99+
<WebProjectProperties>
100+
<UseIIS>False</UseIIS>
101+
<AutoAssignPort>True</AutoAssignPort>
102+
<DevelopmentServerPort>62577</DevelopmentServerPort>
103+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
104+
<IISUrl>
105+
</IISUrl>
106+
<NTLMAuthentication>False</NTLMAuthentication>
107+
<UseCustomServer>False</UseCustomServer>
108+
<CustomServerUrl>
109+
</CustomServerUrl>
110+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
111+
</WebProjectProperties>
112+
</FlavorProperties>
113+
</VisualStudio>
114+
</ProjectExtensions>
115+
</Project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<ProjectExtensions>
3+
<VisualStudio>
4+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" xmlns="">
5+
<WebProjectProperties>
6+
<StartPageUrl>
7+
</StartPageUrl>
8+
<StartAction>CurrentPage</StartAction>
9+
<AspNetDebugging>True</AspNetDebugging>
10+
<SilverlightDebugging>False</SilverlightDebugging>
11+
<NativeDebugging>False</NativeDebugging>
12+
<SQLDebugging>False</SQLDebugging>
13+
<PublishCopyOption>RunFiles</PublishCopyOption>
14+
<PublishTargetLocation>
15+
</PublishTargetLocation>
16+
<PublishDeleteAllFiles>False</PublishDeleteAllFiles>
17+
<PublishCopyAppData>True</PublishCopyAppData>
18+
<ExternalProgram>
19+
</ExternalProgram>
20+
<StartExternalURL>
21+
</StartExternalURL>
22+
<StartCmdLineArguments>
23+
</StartCmdLineArguments>
24+
<StartWorkingDirectory>
25+
</StartWorkingDirectory>
26+
<EnableENC>False</EnableENC>
27+
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
28+
<EnableWcfTestClientForSVC>False</EnableWcfTestClientForSVC>
29+
</WebProjectProperties>
30+
</FlavorProperties>
31+
</VisualStudio>
32+
</ProjectExtensions>
33+
</Project>

0 commit comments

Comments
 (0)