Home All Groups Group Topic Archive Search About

How to use functions of Windows Services from a C#.net app?

Author
5 Nov 2007 6:07 PM
Andrew
Hello, friends,

We have a window application (in C++) installed as a service in a server
machine. We also have a c#.net 2005 application running on client machines.
This c#.net applicaiton needs to use the functions provided in that service.

How to instantiate/call those functions from a c#.net app? Any reference
papers? Thanks a lot.

Author
5 Nov 2007 7:13 PM
Mattias Sjögren
>We have a window application (in C++) installed as a service in a server
>machine. We also have a c#.net 2005 application running on client machines.
>This c#.net applicaiton needs to use the functions provided in that service.
>
>How to instantiate/call those functions from a c#.net app? Any reference
>papers? Thanks a lot.


Have you developed the service or is it from some other vendor? If
it's your own, the easiest way would be to move all the functionality
to DLL that can then be called either by the service or by your C#
application.

You can't just call into a service from another application since they
are running as separate processes (and likely under different security
contexts). You can however communicate between them using some kind of
interprocess communication mechanism, if the service is designed to
handle it of course.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
5 Nov 2007 7:41 PM
Andrew
This app does act as a RPC Server and be able to communicate with windows
service manager...

Then, I guess the question should be: How to communicate/connect with a
service in a server from a c#.net client app?

Thanks again.

Show quote
"Mattias Sjögren" wrote:

>
> >We have a window application (in C++) installed as a service in a server
> >machine. We also have a c#.net 2005 application running on client machines.
> >This c#.net applicaiton needs to use the functions provided in that service.
> >
> >How to instantiate/call those functions from a c#.net app? Any reference
> >papers? Thanks a lot.
>
>
> Have you developed the service or is it from some other vendor? If
> it's your own, the easiest way would be to move all the functionality
> to DLL that can then be called either by the service or by your C#
> application.
>
> You can't just call into a service from another application since they
> are running as separate processes (and likely under different security
> contexts). You can however communicate between them using some kind of
> interprocess communication mechanism, if the service is designed to
> handle it of course.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>

AddThis Social Bookmark Button