User36583972 posted
Hi sivapooja,
Hi, I need to call a native application function with parameter and retrieve the json result? Is it possible to access windows console app or service from web api controller?
As we know, the ASP.NET Web API is a powerful platform for building APIs that expose services and data.
(ASP.NET Web API)HTTP is simple, flexible, and ubiquitous. Almost any platform that you can think of has an HTTP library, so HTTP services can reach a broad range of clients, including browsers, mobile devices, and traditional desktop applications.
The suitable way to access windows console app or service from web api controller is that using a database to pass data between two applications.
If you want to access windows console app or service directly and retrieve the json result, you can use the
Socket
class as a client to connect to remote network services(access windows console app or service ) and as a server to listen for connections from remote clients.
Socket Code Examples
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/socket-code-examples
JSON Serialization And Deserialization In C#
https://www.c-sharpcorner.com/article/json-serialization-and-deserialization-in-c-sharp/
Best Regards
Yong Lu