title: access a local file when live on azure
body: <p>My WCF service needs to access a local .cer file during runtime. In debug mode I'm able to access the file using this:</p>
  
  <pre><code>var testCertificate = new X509Certificate2(HostingEnvironment.ApplicationPhysicalPath + "/testCert.cer");
  </code></pre>
  
  <p>However, this does not work when my service is hosted on Azure. I am unsure as to why this might happen. Does the .cer file need a certain build mode, or be in a specific folder or something else? The file is deployed with the WCF service.</p>
  
  <p>The exception message is:</p>
  
  <blockquote>
    <p>The system cannot find the file specified.</p>
  </blockquote>