[
  {
    "path": ".gitignore",
    "content": "# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)\n[Bb]in/\n[Oo]bj/\n\n# mstest test results\nTestResults\n\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.sln.docstates\n\n# Build results\n[Dd]ebug/\n[Rr]elease/\nx64/\n*_i.c\n*_p.c\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.log\n*.vspscc\n*.vssscc\n.builds\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*\n\n# NCrunch\n*.ncrunch*\n.*crunch*.local.xml\n\n# Installshield output folder \n[Ee]xpress\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish\n\n# Publish Web Output\n*.Publish.xml\n\n# NuGet Packages Directory\npackages\n\n# Windows Azure Build Output\ncsx\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Others\n[Bb]in\n[Oo]bj\nsql\nTestResults\n[Tt]est[Rr]esult*\n*.Cache\nClientBin\n[Ss]tyle[Cc]op.*\n~$*\n*.dbmdl\nGenerated_Code #added for RIA/Silverlight projects\n\n# Backup & report files from converting an old project file to a newer\n# Visual Studio version. Backup files are not needed, because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\n"
  },
  {
    "path": ".nuget/NuGet.Config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <solution>\n    <add key=\"disableSourceControlIntegration\" value=\"true\" />\n  </solution>\n</configuration>"
  },
  {
    "path": ".nuget/NuGet.targets",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n    <PropertyGroup>\n        <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">$(MSBuildProjectDirectory)\\..\\</SolutionDir>\n\n        <!-- Enable the restore command to run before builds -->\n        <RestorePackages Condition=\"  '$(RestorePackages)' == '' \">false</RestorePackages>\n\n        <!-- Property that enables building a package from a project -->\n        <BuildPackage Condition=\" '$(BuildPackage)' == '' \">false</BuildPackage>\n\n        <!-- Determines if package restore consent is required to restore packages -->\n        <RequireRestoreConsent Condition=\" '$(RequireRestoreConsent)' != 'false' \">true</RequireRestoreConsent>\n\n        <!-- Download NuGet.exe if it does not already exist -->\n        <DownloadNuGetExe Condition=\" '$(DownloadNuGetExe)' == '' \">false</DownloadNuGetExe>\n    </PropertyGroup>\n\n    <ItemGroup Condition=\" '$(PackageSources)' == '' \">\n        <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\\NuGet\\NuGet.Config will be used -->\n        <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->\n        <!--\n            <PackageSource Include=\"https://www.nuget.org/api/v2/\" />\n            <PackageSource Include=\"https://my-nuget-source/nuget/\" />\n        -->\n    </ItemGroup>\n\n    <PropertyGroup Condition=\" '$(OS)' == 'Windows_NT'\">\n        <!-- Windows specific commands -->\n        <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), \".nuget\"))</NuGetToolsPath>\n    </PropertyGroup>\n\n    <PropertyGroup Condition=\" '$(OS)' != 'Windows_NT'\">\n        <!-- We need to launch nuget.exe with the mono command if we're not on windows -->\n        <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>\n    </PropertyGroup>\n\n    <PropertyGroup>\n        <PackagesProjectConfig Condition=\" '$(OS)' == 'Windows_NT'\">$(MSBuildProjectDirectory)\\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>\n        <PackagesProjectConfig Condition=\" '$(OS)' != 'Windows_NT'\">$(MSBuildProjectDirectory)\\packages.$(MSBuildProjectName).config</PackagesProjectConfig>\n    </PropertyGroup>\n\n    <PropertyGroup>\n      <PackagesConfig Condition=\"Exists('$(MSBuildProjectDirectory)\\packages.config')\">$(MSBuildProjectDirectory)\\packages.config</PackagesConfig>\n      <PackagesConfig Condition=\"Exists('$(PackagesProjectConfig)')\">$(PackagesProjectConfig)</PackagesConfig>\n    </PropertyGroup>\n    \n    <PropertyGroup>\n        <!-- NuGet command -->\n        <NuGetExePath Condition=\" '$(NuGetExePath)' == '' \">$(NuGetToolsPath)\\NuGet.exe</NuGetExePath>\n        <PackageSources Condition=\" $(PackageSources) == '' \">@(PackageSource)</PackageSources>\n\n        <NuGetCommand Condition=\" '$(OS)' == 'Windows_NT'\">\"$(NuGetExePath)\"</NuGetCommand>\n        <NuGetCommand Condition=\" '$(OS)' != 'Windows_NT' \">mono --runtime=v4.0.30319 \"$(NuGetExePath)\"</NuGetCommand>\n\n        <PackageOutputDir Condition=\"$(PackageOutputDir) == ''\">$(TargetDir.Trim('\\\\'))</PackageOutputDir>\n\n        <RequireConsentSwitch Condition=\" $(RequireRestoreConsent) == 'true' \">-RequireConsent</RequireConsentSwitch>\n        <NonInteractiveSwitch Condition=\" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' \">-NonInteractive</NonInteractiveSwitch>\n\n        <PaddedSolutionDir Condition=\" '$(OS)' == 'Windows_NT'\">\"$(SolutionDir) \"</PaddedSolutionDir>\n        <PaddedSolutionDir Condition=\" '$(OS)' != 'Windows_NT' \">\"$(SolutionDir)\"</PaddedSolutionDir>\n\n        <!-- Commands -->\n        <RestoreCommand>$(NuGetCommand) install \"$(PackagesConfig)\" -source \"$(PackageSources)\"  $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>\n        <BuildCommand>$(NuGetCommand) pack \"$(ProjectPath)\" -Properties \"Configuration=$(Configuration);Platform=$(Platform)\" $(NonInteractiveSwitch) -OutputDirectory \"$(PackageOutputDir)\" -symbols</BuildCommand>\n\n        <!-- We need to ensure packages are restored prior to assembly resolve -->\n        <BuildDependsOn Condition=\"$(RestorePackages) == 'true'\">\n            RestorePackages;\n            $(BuildDependsOn);\n        </BuildDependsOn>\n\n        <!-- Make the build depend on restore packages -->\n        <BuildDependsOn Condition=\"$(BuildPackage) == 'true'\">\n            $(BuildDependsOn);\n            BuildPackage;\n        </BuildDependsOn>\n    </PropertyGroup>\n\n    <Target Name=\"CheckPrerequisites\">\n        <!-- Raise an error if we're unable to locate nuget.exe  -->\n        <Error Condition=\"'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')\" Text=\"Unable to locate '$(NuGetExePath)'\" />\n        <!--\n        Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.\n        This effectively acts as a lock that makes sure that the download operation will only happen once and all\n        parallel builds will have to wait for it to complete.\n        -->\n        <MsBuild Targets=\"_DownloadNuGet\" Projects=\"$(MSBuildThisFileFullPath)\" Properties=\"Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)\" />\n    </Target>\n\n    <Target Name=\"_DownloadNuGet\">\n        <DownloadNuGet OutputFilename=\"$(NuGetExePath)\" Condition=\" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')\" />\n    </Target>\n\n    <Target Name=\"RestorePackages\" DependsOnTargets=\"CheckPrerequisites\">        \n        <Exec Command=\"$(RestoreCommand)\"\n              Condition=\"'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')\" />\n\n        <Exec Command=\"$(RestoreCommand)\"\n              LogStandardErrorAsError=\"true\"\n              Condition=\"'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')\" />\n    </Target>\n\n    <Target Name=\"BuildPackage\" DependsOnTargets=\"CheckPrerequisites\">\n        <Exec Command=\"$(BuildCommand)\"\n              Condition=\" '$(OS)' != 'Windows_NT' \" />\n\n        <Exec Command=\"$(BuildCommand)\"\n              LogStandardErrorAsError=\"true\"\n              Condition=\" '$(OS)' == 'Windows_NT' \" />\n    </Target>\n\n    <UsingTask TaskName=\"DownloadNuGet\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n        <ParameterGroup>\n            <OutputFilename ParameterType=\"System.String\" Required=\"true\" />\n        </ParameterGroup>\n        <Task>\n            <Reference Include=\"System.Core\" />\n            <Using Namespace=\"System\" />\n            <Using Namespace=\"System.IO\" />\n            <Using Namespace=\"System.Net\" />\n            <Using Namespace=\"Microsoft.Build.Framework\" />\n            <Using Namespace=\"Microsoft.Build.Utilities\" />\n            <Code Type=\"Fragment\" Language=\"cs\">\n                <![CDATA[\n                try {\n                    OutputFilename = Path.GetFullPath(OutputFilename);\n\n                    Log.LogMessage(\"Downloading latest version of NuGet.exe...\");\n                    WebClient webClient = new WebClient();\n                    webClient.DownloadFile(\"https://www.nuget.org/nuget.exe\", OutputFilename);\n\n                    return true;\n                }\n                catch (Exception ex) {\n                    Log.LogErrorFromException(ex);\n                    return false;\n                }\n            ]]>\n            </Code>\n        </Task>\n    </UsingTask>\n</Project>\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014 Dan Esparza\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "OWINTest.API/OWINTest.API.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{1671F393-642C-46EA-9FA7-58F53818E724}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>OWINTest.API</RootNamespace>\n    <AssemblyName>OWINTest.API</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">..\\</SolutionDir>\n    <RestorePackages>true</RestorePackages>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Newtonsoft.Json\">\n      <HintPath>..\\packages\\Newtonsoft.Json.4.5.11\\lib\\net40\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Net.Http.Formatting, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Client.5.1.0\\lib\\net45\\System.Net.Http.Formatting.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Core.5.1.0\\lib\\net45\\System.Web.Http.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"ValuesController.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"$(SolutionDir)\\.nuget\\NuGet.targets\" Condition=\"Exists('$(SolutionDir)\\.nuget\\NuGet.targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('$(SolutionDir)\\.nuget\\NuGet.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\\.nuget\\NuGet.targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "OWINTest.API/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"OWINTest.API\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"OWINTest.API\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"d611539e-d658-4ebf-948e-98cc39d62ccf\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "OWINTest.API/ValuesController.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Web.Http;\n\nnamespace OWINTest.API\n{\n    public class ValuesController : ApiController\n    {\n        // GET api/values \n        public IEnumerable<string> Get()\n        {\n            return new string[] { \"value1\", \"value2\" };\n        }\n\n        // GET api/values/5 \n        public string Get(int id)\n        {\n            return \"value\";\n        }\n\n        // POST api/values \n        public void Post([FromBody]string value)\n        {\n\n        }\n\n        // PUT api/values/5 \n        public void Put(int id, [FromBody]string value)\n        {\n\n        }\n\n        // DELETE api/values/5 \n        public void Delete(int id)\n        {\n\n        } \n    }\n}\n"
  },
  {
    "path": "OWINTest.API/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.AspNet.WebApi.Client\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.Core\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"13.0.1\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "OWINTest.Service/API/PersonController.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Web.Http;\n\nnamespace OWINTest.Service.API\n{\n    public class PersonController : ApiController\n    {\n        // GET api/values \n        public IEnumerable<string> Get()\n        {\n            return new string[] { \"value1\", \"value2\" };\n        }\n\n        // GET api/values/5 \n        public string Get(int id)\n        {\n            return \"value\";\n        }\n\n        // POST api/values \n        public void Post([FromBody]string value)\n        {\n\n        }\n\n        // PUT api/values/5 \n        public void Put(int id, [FromBody]string value)\n        {\n\n        }\n\n        // DELETE api/values/5 \n        public void Delete(int id)\n        {\n\n        } \n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/API/RoutedController.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Web.Http;\n\nnamespace OWINTest.Service.API\n{\n    [RoutePrefix(\"api/testing\")]\n    public class RoutedController : ApiController\n    {\n        [Route(\"getall\")]\n        public IEnumerable<string> GetAllItems()\n        {\n            return new string[] { \"value1\", \"value2\" };\n        }\n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/APIServiceTest.Designer.cs",
    "content": "﻿namespace OWINTest.Service\n{\n    partial class APIServiceTest\n    {\n        /// <summary> \n        /// Required designer variable.\n        /// </summary>\n        private System.ComponentModel.IContainer components = null;\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n        protected override void Dispose(bool disposing)\n        {\n            if(disposing)\n            {\n                if (_server != null)\n                {\n                    _server.Dispose();\n                }\n                if (components != null)\n                {\n                    components.Dispose();\n                }\n            }\n            base.Dispose(disposing);\n        }\n\n        #region Component Designer generated code\n\n        /// <summary> \n        /// Required method for Designer support - do not modify \n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            components = new System.ComponentModel.Container();\n            this.ServiceName = \"Service1\";\n        }\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/APIServiceTest.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.ServiceProcess;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Owin.Hosting;\n\nnamespace OWINTest.Service\n{\n    public partial class APIServiceTest : ServiceBase\n    {\n        public string baseAddress = \"http://localhost:9000/\";\n        private IDisposable _server = null;\n        \n        public APIServiceTest()\n        {\n            InitializeComponent();\n        }\n\n        protected override void OnStart(string[] args)\n        {\n            _server = WebApp.Start<Startup>(url: baseAddress);\n        }\n\n        protected override void OnStop()\n        {\n            if(_server != null)\n            {\n                _server.Dispose();\n            }\n            base.OnStop();\n        }\n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5\" />\n    </startup>\n</configuration>"
  },
  {
    "path": "OWINTest.Service/OWINTest.Service.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{040449FC-D996-49AF-BD74-D137D5688992}</ProjectGuid>\n    <OutputType>WinExe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>OWINTest.Service</RootNamespace>\n    <AssemblyName>OWINTest.Service</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">..\\</SolutionDir>\n    <RestorePackages>true</RestorePackages>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Owin\">\n      <HintPath>..\\packages\\Microsoft.Owin.2.0.2\\lib\\net45\\Microsoft.Owin.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Owin.Host.HttpListener\">\n      <HintPath>..\\packages\\Microsoft.Owin.Host.HttpListener.2.0.2\\lib\\net45\\Microsoft.Owin.Host.HttpListener.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Owin.Hosting\">\n      <HintPath>..\\packages\\Microsoft.Owin.Hosting.2.0.2\\lib\\net45\\Microsoft.Owin.Hosting.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Newtonsoft.Json.4.5.11\\lib\\net40\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Owin\">\n      <HintPath>..\\packages\\Owin.1.0\\lib\\net40\\Owin.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration.Install\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Management\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Net.Http.Formatting, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Client.5.1.0\\lib\\net45\\System.Net.Http.Formatting.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Core.5.1.0\\lib\\net45\\System.Web.Http.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Http.Owin\">\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Owin.5.1.0\\lib\\net45\\System.Web.Http.Owin.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.ServiceProcess\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"APIServiceTest.cs\">\n      <SubType>Component</SubType>\n    </Compile>\n    <Compile Include=\"APIServiceTest.Designer.cs\">\n      <DependentUpon>APIServiceTest.cs</DependentUpon>\n    </Compile>\n    <Compile Include=\"API\\PersonController.cs\" />\n    <Compile Include=\"API\\RoutedController.cs\" />\n    <Compile Include=\"Program.cs\" />\n    <Compile Include=\"ProjectInstaller.cs\">\n      <SubType>Component</SubType>\n    </Compile>\n    <Compile Include=\"ProjectInstaller.Designer.cs\">\n      <DependentUpon>ProjectInstaller.cs</DependentUpon>\n    </Compile>\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"Startup.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\" />\n    <Content Include=\"install.cmd\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <None Include=\"packages.config\" />\n    <Content Include=\"uninstall.cmd\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\OWINTest.API\\OWINTest.API.csproj\">\n      <Project>{1671f393-642c-46ea-9fa7-58f53818e724}</Project>\n      <Name>OWINTest.API</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"ProjectInstaller.resx\">\n      <DependentUpon>ProjectInstaller.cs</DependentUpon>\n    </EmbeddedResource>\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"$(SolutionDir)\\.nuget\\NuGet.targets\" Condition=\"Exists('$(SolutionDir)\\.nuget\\NuGet.targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('$(SolutionDir)\\.nuget\\NuGet.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\\.nuget\\NuGet.targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "OWINTest.Service/Program.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.ServiceProcess;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace OWINTest.Service\n{\n    static class Program\n    {\n        /// <summary>\n        /// The main entry point for the application.\n        /// </summary>\n        static void Main()\n        {\n            ServiceBase[] ServicesToRun;\n            ServicesToRun = new ServiceBase[] \n            { \n                new APIServiceTest() \n            };\n            ServiceBase.Run(ServicesToRun);\n        }\n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/ProjectInstaller.Designer.cs",
    "content": "﻿namespace OWINTest.Service\n{\n    partial class ProjectInstaller\n    {\n        /// <summary>\n        /// Required designer variable.\n        /// </summary>\n        private System.ComponentModel.IContainer components = null;\n\n        /// <summary> \n        /// Clean up any resources being used.\n        /// </summary>\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n        protected override void Dispose(bool disposing)\n        {\n            if(disposing && (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n\n        #region Component Designer generated code\n\n        /// <summary>\n        /// Required method for Designer support - do not modify\n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();\n            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();\n            // \n            // serviceProcessInstaller1\n            // \n            this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalService;\n            this.serviceProcessInstaller1.Password = null;\n            this.serviceProcessInstaller1.Username = null;\n            // \n            // serviceInstaller1\n            // \n            this.serviceInstaller1.DisplayName = \"OWIN Service Test\";\n            this.serviceInstaller1.ServiceName = \"OWINServiceTest\";\n            this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);\n            // \n            // ProjectInstaller\n            // \n            this.Installers.AddRange(new System.Configuration.Install.Installer[] {\n            this.serviceProcessInstaller1,\n            this.serviceInstaller1});\n\n        }\n\n        #endregion\n\n        private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;\n        private System.ServiceProcess.ServiceInstaller serviceInstaller1;\n    }\n}"
  },
  {
    "path": "OWINTest.Service/ProjectInstaller.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Configuration.Install;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace OWINTest.Service\n{\n    [RunInstaller(true)]\n    public partial class ProjectInstaller : System.Configuration.Install.Installer\n    {\n        public ProjectInstaller()\n        {\n            InitializeComponent();\n        }\n\n        private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)\n        {\n\n        }\n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/ProjectInstaller.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <metadata name=\"serviceProcessInstaller1.TrayLocation\" type=\"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\">\n    <value>17, 56</value>\n  </metadata>\n  <metadata name=\"serviceInstaller1.TrayLocation\" type=\"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\">\n    <value>196, 17</value>\n  </metadata>\n  <metadata name=\"$this.TrayLargeIcon\" type=\"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\">\n    <value>False</value>\n  </metadata>\n</root>"
  },
  {
    "path": "OWINTest.Service/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"OWINTest.Service\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"OWINTest.Service\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"3c680edc-55b3-4c07-885e-15adc849c05e\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "OWINTest.Service/Startup.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Web.Http;\nusing Owin;\n\nnamespace OWINTest.Service\n{\n    class Startup\n    {\n        //  Hack from http://stackoverflow.com/a/17227764/19020 to load controllers in \n        //  another assembly.  Another way to do this is to create a custom assembly resolver\n        Type valuesControllerType = typeof(OWINTest.API.ValuesController);\n\n        // This code configures Web API. The Startup class is specified as a type\n        // parameter in the WebApp.Start method.\n        public void Configuration(IAppBuilder appBuilder)\n        {\n            // Configure Web API for self-host. \n            HttpConfiguration config = new HttpConfiguration();\n            \n            //  Enable attribute based routing\n            //  http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2\n            config.MapHttpAttributeRoutes();\n\n            config.Routes.MapHttpRoute(\n                name: \"DefaultApi\",\n                routeTemplate: \"api/{controller}/{id}\",\n                defaults: new { id = RouteParameter.Optional }\n            );\n\n            appBuilder.UseWebApi(config);\n        } \n    }\n}\n"
  },
  {
    "path": "OWINTest.Service/install.cmd",
    "content": "path = %path%;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;\n\ninstallutil OWINTest.Service.exe\n\npause"
  },
  {
    "path": "OWINTest.Service/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.AspNet.WebApi.Client\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.Core\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.Owin\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.OwinSelfHost\" version=\"5.1.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Owin\" version=\"4.2.2\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Owin.Host.HttpListener\" version=\"2.0.2\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Owin.Hosting\" version=\"2.0.2\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"13.0.1\" targetFramework=\"net45\" />\n  <package id=\"Owin\" version=\"1.0\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "OWINTest.Service/uninstall.cmd",
    "content": "path = %path%;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;\n\ninstallutil /u OWINTest.Service.exe\n\npause"
  },
  {
    "path": "OWINTest.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.30110.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"OWINTest.Service\", \"OWINTest.Service\\OWINTest.Service.csproj\", \"{040449FC-D996-49AF-BD74-D137D5688992}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"OWINTest.API\", \"OWINTest.API\\OWINTest.API.csproj\", \"{1671F393-642C-46EA-9FA7-58F53818E724}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \".nuget\", \".nuget\", \"{A89D3C9D-EDE8-4518-92A7-045C5DB112A5}\"\n\tProjectSection(SolutionItems) = preProject\n\t\t.nuget\\NuGet.Config = .nuget\\NuGet.Config\n\t\t.nuget\\NuGet.exe = .nuget\\NuGet.exe\n\t\t.nuget\\NuGet.targets = .nuget\\NuGet.targets\n\tEndProjectSection\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{040449FC-D996-49AF-BD74-D137D5688992}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{040449FC-D996-49AF-BD74-D137D5688992}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{040449FC-D996-49AF-BD74-D137D5688992}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{040449FC-D996-49AF-BD74-D137D5688992}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{1671F393-642C-46EA-9FA7-58F53818E724}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{1671F393-642C-46EA-9FA7-58F53818E724}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{1671F393-642C-46EA-9FA7-58F53818E724}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{1671F393-642C-46EA-9FA7-58F53818E724}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "README.md",
    "content": "OWIN WebAPI Service example [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n===========================\n\nSometimes, you just need a good example to get started.  \n\nThe [OWIN-WebAPI-Service project](https://github.com/danesparza/OWIN-WebAPI-Service) came out of a need to create a self-hosted WebAPI 2 service in a Windows service.  Microsoft says that going forward, [OWIN is the way to go](http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api).  I wanted to use [attribute routing](http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2) in WebAPI 2.  I couldn't find a decent example anywhere, so I created my own. \n\n*Please be aware that OWIN (and this project template) are only compatible with .NET 4.5 and newer projects.* \n\n## If starting from scratch:\n\n### Create the service project ###\nIf you're starting from scratch, add a new service project to your solution by selecting **'Windows Service'** in the new project template.\n\n### Add the OWIN Nuget packages ###\n\nFrom the package manager console: \n\n```powershell\nInstall-Package Microsoft.AspNet.WebApi.OwinSelfHost\n```\n\nThis will install the following dependent packages automatically:\n* Microsoft.AspNet.WebApi.Client\n* Microsoft.AspNet.WebApi.Core\n* Microsoft.AspNet.WebApi.Owin\n* Microsoft.AspNet.WebApi.OwinSelfHost\n* Microsoft.Owin\n* Microsoft.Owin.Host.HttpListener\n* Microsoft.Owin.Hosting\n* Newtonsoft.Json\n* Owin\n\n### Create an OWIN configuration handler\nCreate the file `Startup.cs` and put a configuration handler in it:\n\n```CSharp\nclass Startup\n{\n    //  Hack from http://stackoverflow.com/a/17227764/19020 to load controllers in \n    //  another assembly.  Another way to do this is to create a custom assembly resolver\n    Type valuesControllerType = typeof(OWINTest.API.ValuesController);\n\n    // This code configures Web API. The Startup class is specified as a type\n    // parameter in the WebApp.Start method.\n    public void Configuration(IAppBuilder appBuilder)\n    {\n        // Configure Web API for self-host. \n        HttpConfiguration config = new HttpConfiguration();\n        \n        //  Enable attribute based routing\n        //  http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2\n        config.MapHttpAttributeRoutes();\n\n        config.Routes.MapHttpRoute(\n            name: \"DefaultApi\",\n            routeTemplate: \"api/{controller}/{id}\",\n            defaults: new { id = RouteParameter.Optional }\n        );\n\n        appBuilder.UseWebApi(config);\n    } \n}\n```\n    \nNote that:\n* You can load API controllers from another assembly by using the hack `Type valuesControllerType = typeof(OWINTest.API.ValuesController);` or by creating a [custom assembly resolver](http://www.strathweb.com/2013/08/customizing-controller-discovery-in-asp-net-web-api/)\n* You can use Attribute based routing by including the line `config.MapHttpAttributeRoutes()` before the default `config.Routes.MapHttpRoute`\n\n### Add API controllers\nAdd API controllers to the service project by creating classes inherited from `ApiController`.  Here is a simple example that uses attribute based routing:\n\n```CSharp\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Web.Http;\n\nnamespace OWINTest.Service.API\n{\n    [RoutePrefix(\"api/testing\")]\n    public class RoutedController : ApiController\n    {\n        [Route(\"getall\")]\n        public IEnumerable<string> GetAllItems()\n        {\n            return new string[] { \"value1\", \"value2\" };\n        }\n    }\n}\n```\n\nNote that:\n* Controllers in the service assembly will be loaded automatically.\n* If you want to load a controller in another assembly, you'll need to update your `Startup.cs` file (and read the note about loading controllers from other assemblies, above)\n\n### Add code to start/stop the WebAPI listener\n\nAdd code to the default service (inherited from `ServiceBase`) that the Visual Studio template created for you.  The finished service class should look something like this:\n\n```CSharp\npublic partial class APIServiceTest : ServiceBase\n{\n    public string baseAddress = \"http://localhost:9000/\";\n    private IDisposable _server = null;\n    \n    public APIServiceTest()\n    {\n        InitializeComponent();\n    }\n\n    protected override void OnStart(string[] args)\n    {\n        _server = WebApp.Start<Startup>(url: baseAddress);\n    }\n\n    protected override void OnStop()\n    {\n        if(_server != null)\n        {\n            _server.Dispose();\n        }\n        base.OnStop();\n    }\n}\n```\n\nSee how simple that is?  \n* In the `OnStart` handler, we start the listener and pass our `Startup` class we created.  That calls our configuration handler.\n* In the `OnStop` handler, we just stop the listener\n* The service will be listening with a base location of `http://localhost:9000`.\n\n### Install the service\nCreate a service installer by right-clicking on the service design surface and selecting 'Add installer' from the context menu.  You can update the service name, description, [startup mode](http://superuser.com/a/285655/4508) and [default credentials](http://stackoverflow.com/a/510225/19020) by updating the properties on the 2 new controls that are added.  \n\nAfter you've [added the service installer](http://msdn.microsoft.com/en-us/library/ddhy0byf(v=vs.110).aspx) by updating the service code, install the service using the [.NET installutil.exe](http://msdn.microsoft.com/en-us/library/50614e95(v=vs.110).aspx).  See the sample batch files `install.cmd` and `uninstall.cmd` for an example of making this a little easier on yourself.\n\n### Stuff to try\nNow that you've compiled and installed your service, start it up in the 'Services' app in the control panel.  \n* If you've added the `RoutedController` example above, try navigating to the following url in [Postman](http://www.getpostman.com/) or your favorite REST service tester: `http://localhost:9000/api/testing/getall` -- you should get a JSON string array back.  \n* Try hitting breakpoints in your running service in Visual Studio by selecting 'Debug/Attach to Process'.  Select your running service exe, then press 'Attach'.  \n* Try calling the service directly from a browser-based single page application.  (Hint:  You won't be able to until you [enable CORS](http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api))\n\n## Tips\n\n### Building the sample service\n\nSo if you just want to take a look at the sample project, you'll need to either grab the zip or [clone the project](https://help.github.com/articles/which-remote-url-should-i-use/) in git.\n\nBefore you build and install the service you'll need to do a 'Nuget package restore'. The easiest way to do this is probably to right-click on the solution in Visual Studio and select 'Manage Nuget packages for solution...'\n\nYou should see the 'Manage NuGet Packages' screen pop up. At the very top of the screen, you'll probably see a yellow message indicating that 'Some NuGet packages are missing from this solution. Click to restore from your online package sources.' with a Restore button. Go ahead and click Restore and then close the window once the missing packages have been downloaded.\n\nTry your build again after that, and you should be good.\n\n### Installing the service\n\nYou'll need to run the `installutil` command as an Administrator.  To do that, you'll need to [run the command prompt itself as Administrator](https://technet.microsoft.com/en-us/library/cc947813%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396), or use [other interesting tricks](http://stackoverflow.com/a/12401075/19020)\n\n### Serving more than just localhost\n\nIf you want to listen to all requests coming in a certain port -- not just localhost requests, you'll need to know a few things.  \n\n**First**, understand [there are permission differences between Local System, Local service, Network service](http://stackoverflow.com/a/510225/19020), and a user account.  I recommend you run under 'Local service' because it's a minimal set of permissions. \n\n**Second**, you'll need to change the code that starts the service.  Instead of listening for requests to `http://localhost:9000`, you'll need to listen for requests to `http://+:9000`.  \n\n**Third**, you'll need to use the command-line tool `netsh` to authorize 'Local Service' to listen for requests.  I usually put this command in the **install.bat** file that installs the service: \n\n```bash\nnetsh http add urlacl url=http://+:9000/ user=\"Local Service\"\n```\n\nWithout this, you'll have problems starting the service and listening to all requests for that port.\n\n### Help -- I'm getting Error 1053 when trying to start the service\n\nIf you're getting `Error 1053: The service did not respond to the start or control request in a timely fashion.` there is a good chance you don't have the right version of the .NET framework installed.  Remember: OWIN and WebAPI 2 require .NET 4.5 or a more recent version of the framework to be installed.\n\n\n"
  }
]