Cannot create/shadow copy 'XXX' when that file already exists


By default shadow copy is enabled on every appdomain created by ASP.NET. Assemblies loaded will be copied to a shadow copy cache directory, and will be used from there. So that the original file is not locked and can be modified. An error you may encounter when running ASP.Net apps with the debugger is "Cannot create/shadow copy 'XXX' when that file already exists"

Quick Fix
You have to tell ASP.NET not to shadow copy the project assemblies to the ASP.NET temporary folders file by updating your web.config with the following entry:

<configuration>
   <system.web>
      <hostingEnvironment shadowCopyBinAssemblies="false" />
   </system.web>
</configuration>

Then restart your application.
Next Recommended Reading Write a Log file in .Net Application