ASP.Net cannot create/shadow copy

前端 未结 11 1616
暗喜
暗喜 2020-12-29 02:02

I get this error repeatedly when developing ASP.Net applications:

  Cannot create/shadow copy \'XXXXX\' when that file already exists

Where

相关标签:
11条回答
  • 2020-12-29 02:13

    I was getting the same issue, by placing this code in a web.config worked for me.

    <hostingEnvironment shadowCopyBinAssemblies="false" />
    
    0 讨论(0)
  • 2020-12-29 02:15

    The following workarounds come from this now defunct connect issue:

    • add <hostingEnvironment shadowCopyBinAssemblies="false" /> to the <system.web> section of your web.config file.
    • Restart Cassini when you get the problem
    • If you get the error, stop the debugger, right click the solution and "clean solution". Hit F5 to restart debugger. This is really annoying as it has >50% fail rate for me and you would think that there should not be a manual option to CLEAN SOLUTION! This $1200 POS application should clean it for you automatically!
    • Here's another workaround that may be more appealing to some, courtesy of Gary Farr (http://blogs.claritycon.com/blogs/gary_farr/archive/2007/03/09/2888.aspx).
    • Add the following to your pre-build events:

      IF EXIST $(TargetPath).LOCKED (del $(TargetPath).LOCKED) ELSE (IF EXIST $(TargetPath) (move $(TargetPath) $(TargetPath).LOCKED))

    • A workaround that does the job for me is instead of using "Build" use "Build Solution"

    • After a successful build, I count to ten, then I refresh my webform.
    • I have found that by re-registering ASP.NET against IIS the problem "goes away" - I haven't had the problem since. You will need to run the following on the command line:
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i. This more than likely won't work for everyone - it's a complex problem.
    • restart VS.
    • When Cleaning the solution, a few warnings were issued about files that could not be deleted. These files had their read-only property set. After setting the property of these files to read/write, the problem was solved.
    • Restart IIS

    EDIT: Items retrieved from an old version of the page (courtesy of archive.org).

    0 讨论(0)
  • 2020-12-29 02:19

    In my situation only iisreset worked.

    0 讨论(0)
  • 2020-12-29 02:21

    Wait somewhere between 10-30 seconds and hit refresh. For some reason this always works for me.

    0 讨论(0)
  • 2020-12-29 02:21

    Just restart Visual studio, that worked for me.

    0 讨论(0)
  • 2020-12-29 02:27

    Open your project properties, open the Web tab and make sure the Enable Edit and Continue option is not checked.

    0 讨论(0)
提交回复
热议问题