Web Deployment Tool (MS Deploy)
The process cannot access 'file.dll' because it is being used by anot...
Last post Sep 24, 2012 12:30 AM by richard.szalay
May 10, 2012 11:02 PM|alexivanoff|LINK
We have been using MSDeploy for deploying to one of our webn sites for quite some time with no isues. All dlls were managed. Recently we had to add a native dll to the deployment package. Now every time we deploy we get the following error:
An error occurred when the request was processed on the remote computer. An error was encountered when processing 'file.dll'. The error code was 0x80070020. The process cannot access 'file.dll' because it is being used by another process.
What are our options for fixing this?
May 14, 2012 01:04 PM|fab777|LINK
Hi, try ProcessMonitor ([url=http://technet.microsoft.com/en-us/sysinternals/bb896645]http://technet.microsoft.com/en-us/sysinternals/bb896645[/url] to know which process is using 'file.dll'.
May 15, 2012 06:50 PM|alexivanoff|LINK
May 16, 2012 09:02 AM|fab777|LINK
So you can kill it, don't you?
May 16, 2012 06:09 PM|alexivanoff|LINK
We can, but it is not nice.
We are using MSDeploy, so I am looking for a solution that works with MSDeploy.
May 16, 2012 10:21 PM|krolson|LINK
You can choose to ignore that particular error and basically just skip that file by adding a provider setting filePath.ignoreErrors=0x80070020 on your sync - basically this provider setting format (provider-dot-setting) says that even if you're doing an
iisApp sync (or package to iisapp/auto/apphostconfig/whatever), where the provider doesn't have the ignoreErrors setting, you want to use this ignoreErrors setting on any child filePath provider operations (as filePath is a child provider of other providers
FilePath provider page with some explanation of the ignoreErrors setting:
Hope that helps!
May 16, 2012 10:51 PM|alexivanoff|LINK
But the file will not be copied/updated, right? This is not what we want.
May 16, 2012 11:11 PM|krolson|LINK
Ah - I wasn't sure what you meant by "work around"! If you mean how can you kill the process that's holding the file and then restart it using Web Deploy - I suggest trying out preSync and postSync runCommand operations to run a command to stop the offending
process before the sync starts, then to run a command to start it again after the sync completes.
RunCommand provider page:
Format example for preSync/postSync on this page:
May 17, 2012 03:37 AM|alexivanoff|LINK
May 17, 2012 04:14 PM|krolson|LINK
If it is the application pool - you can also directly recycle the application pool using the recycleApp provider (possibly still as a preSync command) - that would limit it to recycling just the specified application pool and you wouldn't have to deal with
process start/stop command line. You give the name of the site or app path for the application you want to recycle (like "Default Web Site" or "MySite/MyApp") as the path for recycleApp - not the application pool name. Recycling the application pool when you're
making updates to the application code is probably a good idea regardless.
More info on recycleApp provider:
Is that the kind of thing you were looking for? If you are looking for a way to replace the file without stopping the process using it, I'm afraid nothing comes to mind.
Sep 24, 2012 12:30 AM|richard.szalay|LINK
If you are using MSDeploy v3, you can try setting "-enableRule:AppOffline" which will write an App_Offline.htm file for the duration of the deployment. This, in turn, triggers ASP.NET to take down the AppDomain.