If you are using the shared memory remoting channel from GenuineChannels under Vista, you can quickly become a victim of a new security feature of Windows Vista: Global objects (a Mutex in the global namespace, for example) can only be created in session 0 - and with Vista, only services run in session 0.
The GenuineChannels SharedMemoryChannel creates a global mutex by default, and will fail with with this error message:
Can not create or open a memory file mapping. Error code: 2. Use the Visual C++ Error Lookup utility to see the text of the error message.
Consider the following code for the initialization of the remoting infrastructure:
1 publicvoid InitializeRemoting(string name, string address)
2 {
3 Hashtable properties;
4 GenuineSharedMemoryChannel channel;
5
6 properties = newHashtable();
7
8 properties = newHashtable();
9 properties["listen"] = address;
10 properties["name"] = name;
11 properties["priority"] = 100;
12
13 channel = newGenuineSharedMemoryChannel(properties, null, null)
14 ChannelServices.RegisterChannel(channel);
15 }
To force the channel to create session-local objects only, insert the following line at line 12:
12 properties["smsessionlocal"] = true;