How to self host web api in console apps when multiple controller is there RRS feed

  • Question

  • User264732274 posted

    suppose i have many controller say for CustomerController, productController, OrderController etc. so tell me how could i self host those all controller in windows console apps or windows service as a result other windows client can send request to web api.

    please show me the code by which i can host multiple controller in windows console or windows service. when self host then how could i do the attribute routing or conventional routing etc.

    if possible include few links for the same issue. thanks

    Friday, August 5, 2016 2:37 PM


All replies

  • User-782232518 posted


    Use Google, and it returns tons of links and code like this.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 6, 2016 3:12 AM
  • User264732274 posted
    I am using attribute routing in web api controller instead of conventional routing. So when i will self host the service in console apps or in windows service then what i need to do as attribute routing should work with self host? Please share the suggestion.
    Saturday, August 6, 2016 4:47 PM
  • User-782232518 posted

    Did you ever try it out? If Microsoft makes attribute routing part of the feature set, they won't simply let it work only on IIS, right?

    Sunday, August 7, 2016 6:22 AM
  • User264732274 posted
    No i did not tried. I just doubt does attribute routing works fine when self host web api in windows service. Do you know anything about it?
    Sunday, August 7, 2016 6:39 PM
  • User36583972 posted

    Hi sudip_inn,

    Attribute routing is working fine when self host web api. I have made a sample on my side.

    You can refer the following posts:


    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 8, 2016 2:13 AM