OwinSelfHost .net4.5.2 example with api

 1. cerate .net console (not core)

2. add owin startup class and add httpconfig

3.edit program.cs. base adress and webapp.start






using Microsoft.Owin;
using Owin;
using System.Web.Http;

[assembly: OwinStartup(typeof(OwinSelfHost.Startup))]

namespace OwinSelfHost
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {

            HttpConfiguration config = new HttpConfiguration();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            app.UseWebApi(config);


        }


    }
}

Github public :
https://github.com/doktoralban/OwinSelfHost

Yorumlar