简体   繁体   中英

Create ASP.NET WEB API using Console application

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 console application. if possible, how can it be hosted? how Executable file gives us the URL to consume from client application.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM