1

Is it possible to self-host an Asp.Net MVC 5.2 web application in a console application or must I move everything to Asp.Net Core?

I have legacy web applications that now must be hosted in a console application instead of IIS. I have successfully hosted the Web Api but am having trouble doing the same with the front-end applications.

In my web applications the controllers are not executed even though I have added a route to them.

public void Configuration(IAppBuilder app) // in the OWIN startup class
{
    app.Use((context, next) => next.Invoke() ); // breakpoint is hit

    var config = new HttpConfiguration();

    config.Routes.MapHttpRoute( // does not seem to be used
        "Default",
        "{controller}/{action}/{id}",
         new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}
MatiasK
  • 686
  • 1
  • 7
  • 20

0 Answers0