title: Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed?
body: <p>I'm getting an error that seems to only occur on machines running <a href="https://en.wikipedia.org/wiki/Windows_Server_2012" rel="nofollow noreferrer">Windows Server 2012</a>. My application was written for a .NET 4.0 environment. My hypothesis is something in the .NET 4.5 isn't playing nicely with my application. I have no other ideas.</p>
  
  <p>The application is designed to create PDF files. It will do this by calling multiple instances of itself. The main application will call another EXE file with a set of parameters that indicate which PDF files to create.</p>
  
  <p>In this way we can call multiple EXE files, speeding up the process. For testing purposes, I can disable the calls to outside programs by changing a setting this will create all the PDF files with the same program, just more slowly.</p>
  
  <p>The PDF files will be saved onto a local hard drive. The user should have access to all local drives and all administrator privileges. There are no hidden folders.</p>
  
  <p>As soon as the main application goes to call a new instance of itself, it will crash. See the picture below. Either it can't use the EXE file, or it can't write to the local drive. I'm not sure which; if I need to create a log I will, thus I can determine if the application can't call the EXE file or if the application can't write to the local drive.</p>
  
  <p>However, if I run the same application as administrator it runs correctly. Running as administrator isn't a viable solution for the long term. This makes me think it's not really a .NET issue.</p>
  
  <p>Another thing, if I change the setting to create all the PDF files internally it will run correctly. This doesn't require the elevated privileges. This proves that the user should have access to the drive.</p>
  
  <p>The application that has run stably(ish) for months off an older system <a href="http://en.wikipedia.org/wiki/Windows_Server_2003" rel="nofollow noreferrer">Windows Server 2003</a> with .NET 4.0 installed.</p>
  
  <p>I'm attempting to move the application to a new server, Windows Server 2012, by default .NET 4.5 or above is installed.</p>
  
  <p>I have no debugger on the target system. Everything runs fine on my development environment and from the old production environment.</p>
  
  <p><img src="https://i.stack.imgur.com/hXYWS.jpg" alt="Picture of error message box"></p>