title: Why is Configuration.FilePath returning a nonexistent file?
body: <p>I have a Windows service, written in C# (.NET 4.5). This service has a <code>user</code> scoped setting that is used to hold a timer variable. For debugging the service, I need to update this variable, so I need to know where the <code>user.config</code> file for the service is located. Hence I added the following code in the service's <code>OnStart()</code> method:</p>
  
  <pre><code>Logger.InfoFormat("user.config at \"{0}\"", ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
  </code></pre>
  
  <p>What is dumped into my logfile is the following path:</p>
  
  <pre><code>C:\Windows\system32\config\systemprofile\AppData\Local\company\service.exe_Url_randomcharacters\1.0.0.0\user.config
  </code></pre>
  
  <p>But when I try to open that file, it doesn't exist. After doing a Windows search, I found the actual file at:</p>
  
  <pre><code>C:\Windows\SysWOW64\config\systemprofile\AppData\Local\company\service.exe_Url_randomcharacters\1.0.0.0\user.config
  </code></pre>
  
  <p>Why is this? I'm assuming some 32-bit/64-bit compatibility magic, but what would be the correct code (if any) to get the actual path?</p>
  
  <p>Additional info, if it helps: the service is running on a Windows Server 2008 R2 64-bit machine and it was installed via <code>installutil</code>. I'm not sure whether the 32-bit or 64-bit version of <code>installutil</code> was used though - would this make a difference?</p>