Open vinaydwivedi opened 3 years ago
What is the window service authenticating as? I would say you need to change this.
Window service is authenticated as Network service, tried running it under local service account as well, doesn't work.
I believe the service must be running using an account that has the Local Security Policy “Create global objects” allowed.
Yes, please see below, Just to be sure, if this is not permission issue, I granted create "create global objects" to everyone.
Could following be required, don't see this being set.
var security = new MemoryMappedFileSecurity();
security.AddAccessRule(new AccessRule
Probably for the client to connect but that does not explain why you can’t create the initial MMF.
Both the issue were from client side. I have switched to Managed version of MemoryMapped files, and able to work as expected with security MemoryMappedFileSecurity added.
Ah I thought the issue was creating not opening existing. Anyway, sounds like that is the issue, thanks.
Hey, vinaydwivedi. Can you explain your solution more detailed? I have similar issue but with CircularBuffer, between service (net47) and consol (net35)
Hey all, bumping this issue thread again because we are also running into this issue.
SharedMemory via RpcBuffer works fine when the host & client are console applications, but no longer when the host is a Windows Service.
I tried the Global\Name
approach, but this is not a feasible solution for us as we are deploying to hundreds of machines and would rather not modify permissions for all users on these machines just for sharing a mutex lock.
I also tried cloning the project, adding MutexSecurity
as a parameter to RpcBuffer
and using it to initialize the Mutex. However, I still ran into the same issues (probably due to a lack of knowledge about how to properly configure this).
Is there anyone in this thread who is willing to post their solution?
I haven’t had a chance to look at this in a lot of detail yet, but the MutexSecurity
looks like the correct approach to me.
It looks like you need to use a security descriptor with null DACL (might not be possible using current managed classes) - take a look at the following (old but might provide some direction) https://www.codeproject.com/Articles/14022/A-security-neutral-mutex-class-for-the-managed-pla
private SharedMemory.SharedArray _buffer = _buffer = new SharedArray(@"Global\MARKETTICK", 200000); from within window service.
Try creating SharedMemory.SharedArray _reader = new SharedArray(@"Global\MARKETTICK");
I Get "Access to the path 'Global\MARKETTICK_evt_write' is denied"
When I create the file without Global Prefix i.e. private SharedMemory.SharedArray _buffer = _buffer = new SharedArray("MARKETTICK", 200000); from within window service.
from Console SharedMemory.SharedArray _reader = new SharedArray(@"MARKETTICK");
I get file not found error.