I need my Service to update fields in shared memory for a client application to read and display. I've found my current solution to be ineffective because of Session 0 Isolation.
I've renamed the mutex
es in the Global namespace which fixes that element but it doesn't look as though the dll will be amenable to sharing between sessions despite one solution to Session 0 Isolation being:
"Explicitly choose either the Local\ or Global\ namespace for any named objects, such as events or mapped memory that the service makes available."
I don't know which part of the dll can be classified as a named object and it will take too long to keep re-installing and stepping through it to check.
I saw the code volumes for named channels and was put off. I don't want to create a file that touches the disk as I imagine is required of the memoryMappedFile solution. Can shared sections of dlls be made to work? Otherwise what is easiest?
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'm using .NET 2.0 so no WCF please.
I'd suggest named pipes: then you have proper controlled isolation between the two processes. Sharing DLLs sounds like it's fraught with danger.
Named pipes are documented on MSDN here: http://msdn.microsoft.com/en-us/library/aa365590.aspx
and a useful looking .NET 2.0 article is here: http://www.switchonthecode.com/tutorials/interprocess-communication-using-named-pipes-in-csharp
(Bear in mind that .NET 3.5 and above has a NetNamedPipeBinding class [ http://msdn.microsoft.com/en-us/library/system.servicemodel.netnamedpipebinding.aspx ] that's part of WCF)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With