【问题标题】:Is It Possible for Two Applications to Create a Memory Mapped File with the Same Name?两个应用程序可以创建同名的内存映射文件吗?
【发布时间】:2020-08-27 18:12:14
【问题描述】:
【问题讨论】:
标签:
c#
memory-mapped-files
【解决方案1】:
经过测试发现抛出了异常:
Unhandled exception. System.IO.IOException: Cannot create a file when that file already exists.
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateCore(FileStream fileStream, String mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, MemoryMappedFileOptions options, Int64 capacity)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(String path, FileMode mode, String mapName, Int64 capacity, MemoryMappedFileAccess access)
at LiveFileReader.AsyncLiveFileReader..ctor(String filePath) in ...