Expose an API end point inside a .net core console application is this possible

john john 961 Reputation points
2021-10-08T11:39:26.77+00:00

I am working on a new project which contain 2 main parts:-

1) Schedule service which reads files from SharePoint online and send them to external API

2) The external API will proceed the received documents using AI models >> extract data from the documents >> then Push the extracted data back to our system >> where our system will update SharePoint with the extracted data.
So currently I am defining the technologies that I am going to use, where I define the following: -

1) For point one, I am going to build a .net core console application >> hosted it inside windows server >> schedule it using windows tasks scheduler. This service will read the files from SharePoint using SharePoint API >> send them to the external API.

2) But I am not sure about point 2? How I am going to received the pushed data from the external API inside our system? Can I define an API end point inside my console application? or for this I need to build something like asp.net MVC core hosted inside IIS which exposed some API endpoints to get the pushed data? Keeping in mind that the external API and our system will be installed inside the same windows server.

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,841 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,553 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
336 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 28,291 Reputation points
    2021-10-08T12:22:24.303+00:00

    Keeping in mind that the external API and our system will be installed inside the same windows server.

    I can't make heads or tails of you're question. My best guess is you have a Web API application which contains logic you wish to share with a Console application. Class libraries solve this programming problem. Move the logic from the Web API app into a class library then share the library (DLL) with the Web API and Console applications.

    If this does not answer your question, can you clarify the problem?

    2 people found this answer helpful.

  2. Bruce (SqlWork.com) 65,131 Reputation points
    2021-10-08T14:42:11.417+00:00

    All asp.net core applications are console apps. You can run them standalone or host with IIS. IIS adds support for startup and recovery from a crash.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.