Friday, May 20, 2011

Cannot create/shadow copy 'File Name' when that file already exists

Workarounds

Configure hostingEnvironment in Web.config

<system.web>
<hostingEnvironment
idleTimeout="120"
shutdownTimeout="30"
shadowCopyBinAssemblies="false" />
</system.web>

Add these lines in the pre-build event command line, which basically unlocks the DLL within Visual Studio.

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

Friday, May 06, 2011

The path maps to a directory outside this application, which is not supported.

Problem
Error thrown when virtual folder has trailing backslash at end of Local Path setting in IIS.

Solution
Remove trailing backslash at end of Local Path setting in IIS of virtual folder.

Error message in ASP.NET v2.0

Server Error in '/MyBadVirtualFolder/MyApplicationFolder' Application.
The path '/MyBadVirtualFolder/MyApplicationFolder/App_GlobalResources/' maps to a directory outside this application, which is not supported.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.