locked
Call native app and retieve the value RRS feed

  • Question

  • User-590375999 posted
    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?
    Saturday, March 2, 2019 2:11 PM

All replies

  • User475983607 posted

    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?

    There is magical solution. 

    A console application or, I assume you mean Windows Service, must be build in a way to allow access.  A common and simple method is using a database to pass data between two applications. There are other technical method like crafting a TCP listener in the console or Windows Service;  pipes, file listeners, etc.

    Saturday, March 2, 2019 3:49 PM
  • 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

    Tuesday, March 5, 2019 6:44 AM
  • User-474980206 posted

    you use the process class ton run a console app. typically the console app would write to standard out, which you would stream in. see:

      https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=netframework-4.7.2

    google for lots of examples and work around for issues that might arise. 

    Tuesday, March 5, 2019 3:23 PM