Код: Выделить всё
var security = new MemoryMappedFileSecurity();
security.SetAccessRule(new AccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MemoryMappedFileRights.FullControl, AccessControlType.Allow));
MemoryMappedFile memoryMappedFile = MemoryMappedFile.CreateFromFile(
new FileStream(path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite),
"MMFName",
100000000,
MemoryMappedFileAccess.ReadWrite,
security,
HandleInheritability.None,
false
);
Стек трассировка:
Код: Выделить всё
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateCore(SafeFileHandle fileHandle, String mapName, HandleInheritability inheritability, MemoryMappedFileSecurity memoryMappedFileSecurity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, Int64 capacity)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(FileStream fileStream, String mapName, Int64 capacity, MemoryMappedFileAccess access, MemoryMappedFileSecurity memoryMappedFileSecurity, HandleInheritability inheritability, Boolean leaveOpen)
Подробнее здесь: https://stackoverflow.com/questions/786 ... -is-denied