title: c#: Why does opening a read-only file for read access fails
body: <p>I am trying to open a file in a windows service. But am getting Access denied error.
  I am using the below code.</p>
  
  <pre><code>FileStream stream = File.Open('sample.txt', 
  FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
  </code></pre>
  
  <p>As you see here, i am only opening with read permission. And the file already has a read-only permission checked in the properties dialog. But, still i can't understand why i am getting this error. </p>
  
  <p>Thanks in advance</p>