0

I have created a service on Windows it is installed on localhost and now have to interact with this service .

Inside my web application I'll give a query command that will be sent to this service and this service will make this query on another IP and return the result to the application .

Within the OnStart method I created a StreamWriter 's fulfilling a text file , to make sure that the service is working.

How do I send requests for this service and receive his answers ?

  • Use one of the standard .NET process interop mechanisms to talk to the service. A socket, named pipe and WCF are always on the top of that list. Do keep in mind that a service normally runs with a very privileged account so you can't ignore the need to protect against shatter attacks. – Hans Passant May 18 '16 at 13:21
  • @Hans Passant - You have an example to help me start this interoperability , I'm lost with this connection and I've tried so many things that did not work I do not know where to start .... – João K. Queiroz May 18 '16 at 13:29
  • See the SO question [IPC Mechanisms in C# - Usage and Best Practices](http://stackoverflow.com/questions/56121/ipc-mechanisms-in-c-sharp-usage-and-best-practices). – Scott Chamberlain May 18 '16 at 13:53
  • Hard to imagine I could write a better example than the ones already available in the MSDN documentation. Realistically, if you don't know how to use a service then you are much, *much* better off not using one. A service almost always has nasty security, reliability and scaling issues when used by a web server. – Hans Passant May 18 '16 at 13:54
  • Thank you Scott and Hans for help , I will continue looking for a way to make it happen. As for not using the service, I do not have this option . – João K. Queiroz May 18 '16 at 13:59

1 Answers1

0

To solve my problem I created a socket server on this basis .

https://msdn.microsoft.com/en-us/library/bew39x2a%28v=vs.110%29.aspx https://msdn.microsoft.com/en-us/library/fx6588te%28v=vs.110%29.aspx

Creating the service within the same Web page solution that will display the information sought by the service.