Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment of PrecompiledApp issue

The autogenerated PrecompiledApp.config is causing me some headache. Im automating the deployment of an older web site and 50% of the time when I deploy I get this error:

System.IO.IOException: The process cannot access the file '\\web.prod.local\c$\Sites\Website\PrecompiledApp.config' because it is being used by another process.

Content:

<precompiledApp version="2" updatable="true"/>

To the best of my knowledge websites uses some shadow copy feature to allow updating the site "runtime", with things such as app.config etc. However this 1 file seems to be an exception.

Can anyone suggest a workaround besides stopping the website while deploying?

Kind regards

like image 392
Christian Mikkelsen Avatar asked Oct 16 '13 08:10

Christian Mikkelsen


Video Answer


1 Answers

Judging by the path in the error message I see you're trying to copy the files over a network share while deploying. This is bad practice to update the files directly over a network share or FTP etc. And this is the reason, actually. Network deployment is slow and while some files are still being updated/uploaded - the ASP.NET on the server is already trying to recycle the app, copy the files to "Temporary ASP.NET folders" etc. etc. etc.

Deployment best practice:

ZIP your precompiled site, upload, then run UNZIP on the server remotely

Here's how you run UNZIP remotely:

plink -ssh -l USERNAME -pw PASSWORD web.prod.local c:\Sites\Website\unzip -q -o c:\Sites\Website\site.zip -d c:\Sites\Website\

"plink" is a free SSH tool for windows (command-line) you need it on your dev machine

"web.prod.local" is your server address.

"c:\Sites\Website\" is the path your website on the server

You need SSH installed on your server to run commands remotely, the simplest option is too install the free tool: "freesshd" (google it)

Drop "unzip.exe" on the server as well, you see it's being called right there. Simplest way is to drop it right into the c:\Sites\Website\

PS. This is just an example, you can come up with your own solution

like image 148
Serge Shultz Avatar answered Oct 11 '22 23:10

Serge Shultz