I am running into an issue deploying a website. Shadow copy is turned off after previous deployment issues with it and deploying the site.
Specifically at deploy time I find that even after copying app_offline.htm
and verifying that the site/application is offline, the files in bin/*.dll
are often locked.
With shadow copy off I would still expect the locks on the dll's to be free'd when the appdomain
is unloaded on app_offline.htm
appearance.
I have tried deploying a temporary web.config
found on Stack Overflow
which aims to prevent changes (to bin/
) being picked up immediately just before I try to delete the contents of bin/
I even pause for 10s
after copying the new web.config
.
?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime waitChangeNotification="300"
maxWaitChangeNotification="300"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
I have confirmed with the handles util that my application pool (w3wp.exe
process) is the holder of a lock on the dlls so am assuming this is the reason why I cannot delete/overwrite the files. If i manually recycle the app pool it frees it up and I am able to deploy just fine. Unfortunately as part of the deploy process copying the app_offline and changing the web.config are possible but performing IIS
appcmd recycles are not (for permissions/group policy reasons) so I really need to be able to free up this lock with just app_offline.htm
and the web.config.
Turning shadow copy back on does 'solve' this particular issue but if a lock is still held on the dll. However I wonder / and concerned if I am just postponing the problem. Unless the lock on the old dll is free'd when the appdomain
is loaded again?
When copying the app_offline.htm
the w3wp
process id doesn't change like it does with a hard recycle but I assume it is unloading the appdomain
which should free the bin/ files
it has locked.
Another interesting point is that this only appears to happen on our production servers, I cannot recreate it locally or on our dev/staging sites. I don't believe there is any config difference with the app_pools
or IIS
config but could this possible cause this behavior.
Also to clarify shadowCopyBinAssemblies
has been set to false for over 3 years without this problem happening (same deploy process) so I really feel like something that happened recently caused this, but I have no idea what.
Thanks for any ideas on how to solve this or even what might be causing it.
(I believe the server is IIS7
or 7.5
)