I am writing a program in .NET4 which generates Memory Mapped Files in this way: MemoryMappedFile.CreateNew("TEST", int.MaxValue))
I have created ISAPI module which is instaled on IIS7, this module would read MemoryMappedFile but unfortunately it does not work, I get an error: System.IO.FileNotFoundException: Unable to find the specified file.
The Program is on the same PC as IIS7, IIS works on the same user as my program. If I put my code from ISAPI to another program and I can read MemoryMappedFile without any problems.
The same problem occours when I use my code (which read MemoryMappedFile) in ASP.NET. It looks like IIS blocked MemoryMappedFile between system aplication and ISAPI or ASP.NET.
How to solve it? MemoryMappedFile is important to me.
Thanks
Without being able to look at the code in question, I can suggest some avenues of investigation:
Are you certain that the handle still exists at the time you are attempting to access it via the ISAPI extension? If the process that created the file is no longer running, it will be garbage-collected and will not be found. You can use Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653) to search for your memory-mapped file (it will appear as a handle of type "section").
If that doesn't work, try having your ISAPI extension allocate its own memory-mapped file and see if it can read it's own files.
Try allocating a lower capacity to the memory mapped file - setting the capacity to 4 GB as in your example might be the issue.