interprocess icon indicating copy to clipboard operation
interprocess copied to clipboard

System.UnauthorizedAccessException: 'Access to the path is denied.' When Create Publisher

Open cbfrank opened this issue 3 years ago • 3 comments

Hi On windows, there is System.UnauthorizedAccessException: 'Access to the path is denied.' if the publisher and subscriber are created by different accounts in different processes. for example, a windows service process create a subscriber, later, when an user application try to create the publisher, the exception will be thrown. Can we create the memory mapped file that can be accessed by all everyone?

Thanks

cbfrank avatar May 16 '21 09:05 cbfrank

@cbfrank . Same problem here, when running the Main application as Windows Service under LocalSystem Account. The other apps running under a normal account can't access the Queue Semaphore with Access denied error. I made a patch to Cloudtoid.Interprocess package to make the Named Semaphore accessible to Everyone.. Check the solution here https://github.com/fabalo76/interprocess/tree/WinSemaphoreACLs

As this is an unofficial branch (pending to merge with official branch) and only tested in Windows ,you have to install the package manually in your visual studio. You could compile it by yourself or try my binary package Cloudtoid.Interprocess.1.0.156.zip

Check the source code for Semaphore/Windows/SemaphoreWindows.cs image

fabalo76 avatar Jun 03 '21 15:06 fabalo76

@fabalo76 I'm not sure giving the Everyone account full control is the best idea from a security perspective. Ideally, you'd be able to configure it, so you can grant the required access rights only for the actual accounts at either end of the pipe.

cocowalla avatar Jun 03 '21 19:06 cocowalla

Hey folks, any suggestions on the best way to provide a solution here? I'd be happy to implement it.

prezaei avatar Jul 11 '21 07:07 prezaei