Note that there are some explanatory texts on larger screens.

plurals
  1. POOpening a Memory Mapped File causes FileNotFoundException when deployed in IIS
    primarykey
    data
    text
    <p>Following the code example from <a href="http://gunnarpeipman.com/2009/06/net-framework-4-0-using-memory-mapped-files/">this</a> website, I created a windows console application that creates a mapped memory file:</p> <pre><code> using (var file = MemoryMappedFile.CreateNew("myFile", 24)) { var bytes = new byte[24]; for (var i = 0; i &lt; bytes.Length; i++) bytes[i] = (byte)(65 + i); using (var writer = file.CreateViewAccessor(0, bytes.Length)) { writer.WriteArray&lt;byte&gt;(0, bytes, 0, bytes.Length); } Console.WriteLine("Run memory mapped file reader before exit"); Console.WriteLine("Press any key to exit ..."); Console.ReadLine(); } </code></pre> <p>in a new asp.net web application I read the MMF using the code:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { string sOutput = ""; using (var file = MemoryMappedFile.OpenExisting("myFile")) { using (var reader = file.CreateViewAccessor(0, 24)) { var bytes = new byte[24]; reader.ReadArray&lt;byte&gt;(0, bytes, 0, bytes.Length); for (var i = 0; i &lt; bytes.Length; i++) sOutput += (char)bytes[i] + " "; } } Response.Write(sOutput); } </code></pre> <p>In the development IIS Express the file is read as expected and the page displays the data from the mapped memory file.</p> <p>However, When deployed to IIS I get the exception <code>System.IO.FileNotFoundException</code> at the location<code>MemoryMappedFile.OpenExisting("myFile")</code></p> <p>I tried changing the app pool identity to the same as the one running the MMF console application but this does didn't work. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload