Sharing memory between Windows Service and Application, which is the easiest?

I need my Service to update fields in shared memory for reading and displaying a client application. I found that my current solution is inefficient due to Session Isolation .

I renamed mutexes in the global namespace, which corrects this element, but it does not look as if the DLL was able to share between sessions, despite one solution to isolate session 0:

"Explicitly select either a local or global namespace for any named objects, such as events or associated memory, that the service provides."

I do not know what part of the dll can be classified as a named object, and it will take too much time to continue to reinstall and go through it to check.

I saw code volumes for named pipes and was delayed. I do not want to create a file that touches the disk, as I believe it is required from the memoryMappedFile solution. Can shared DLL sections work? Otherwise, what is the easiest way?

public ref class ServerGUIBridge
{
public:
#pragma data_seg(".sdata")
    static int commonIntShouldBeGlobal = 0;
    static bool hasBeenInitializedMakeMeGlobal = false;
#pragma data_seg()
#pragma comment(linker, "/section:.sdata,rws")

I am using .NET 2.0, so there is no WCF.

+5
source share
3 answers

One often ignored IPC method is writing to the registry. For the two members of the POD, I suggest sharing this would be the perfect solution. IPC, MSDN and registry

0
source

All versions of the .NET platform have a Remoting feature. It allows you to call methods in another application, which may be in separate processes. See MSDN for samples and usage: http://msdn.microsoft.com/en-us/library/kwdt6w2k(v=VS.80).aspx

0
source

All Articles