Restful Service Hosting RRS feed

  • Question

  • Hosting -

    With WCF you end up with a .svc file   I was following a utube tutorial ( ) and to my surprise I dont see a .svc file. I am not clear its even WCF Restful but it is REST.  It does get hosted on the internal IIS local host with Visual Studio & runs.  How then do I host on IIS 7 ? Curiously no interface either is created.  What doee IIS use to identify and create the service (? )

    using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace SimpleRESTServer.Controllers { public class PersonController : ApiController { // GET: api/Person public IEnumerable<string> Get() { return new string[] { "Person1", "Person2" }; } // GET: api/Person/5 public string Get(int id) { return "value"; } // POST: api/Person public void Post([FromBody]string value) { } // PUT: api/Person/5 public void Put(int id, [FromBody]string value) { } // DELETE: api/Person/5 public void Delete(int id) { } } }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Http;
    namespace SimpleRESTServer
        public static class WebApiConfig
            public static void Register(HttpConfiguration config)
                // Web API configuration and services
                // Web API routes
                    name: "DefaultApi",
                    routeTemplate: "api/{controller}/{id}",
                    defaults: new { id = RouteParameter.Optional }

    Above was mostly autogenerated ( I only changed the controller name ) and per the utube value 1,2 became person 1,2

    I had a restful tool for firefox call to test it using http://localhost:44189/api/Person & it worked !

    But how to get this or similar items developed this way on IIS - I imagine I have to call it an application but then what  ?

    Thanks Andrew


    Saturday, November 4, 2017 1:57 AM


  • OK I think I figured it out.

    1. Since my folder for the 'app' is outside the WWWROOT  create a virtual directory to the path.

    2. Then it will show up like a shortcut in IIS Manager

    3. Right mouse click and convert to application. ( I did add a simple default.html with one line ) - Dont =know if needed


    • Marked as answer by andrewcw Saturday, November 4, 2017 5:40 AM
    Saturday, November 4, 2017 5:39 AM