1
Reply

2 services (WCF Web API and ASP.NET Web API) on one host

ВЕРАСЕНЬ 88

ВЕРАСЕНЬ 88

Oct 20 2014 9:15 AM
897
Preconditions:
1) local DB with users
2) console application (OWIN selfhost) + Controller (inherit from ApiController) for POST requests - import users to the DB:
 
 
public class Startup
{
      public void Configuration(IAppBuilder appBuilder)
      {
            var config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();
            appBuilder.UseWebApi(config);
      }
}
public class Start
{
      static void Main()
      {
            var baseUrl = ConfigurationManager.AppSettings["BaseUrl"];
            using (WebApp.Start<Startup>(baseUrl))
            { Console.ReadLine(); } 
      }
 }
Problem: how can I add a WCF service to the app (wcf service should return user from the DB by ID). Can anybody suggest right solution to get 2 services on one selfhost?

Answers (1)