Create ASP.NET WEB API using Console application

后端 未结 1 1209
北海茫月
北海茫月 2021-01-13 18:01

I have seen many articles in Internet to create RESTFUL webapi by selecting webapi project as project type. Is there any possibility that we can create the same using consol

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-13 18:22

    Yes, there is a possibility. but we need to flow some steps to achieve this.

    1. we should use OwinSelfHost package for self hosting.
    2. we should create as class file that inherits from ApiController.
    3. install cors package for webapi application that is used for client to consume the application.

    Hosting: domain name or IP should be given where the service is hosted.

    Reference Example

    0 讨论(0)
提交回复
热议问题