Support recycleApp in WebDeploy provider

hannes's Avatar


25 Oct, 2015 07:10 PM

I'm using AppVeyor to build and deploy my ASP.NET 5 beta 8 projects, see for a live example of my YML.

It works fine (AppVeyor is a great CI platform, love it), but I have to work around an issue with the WebDeploy provider: For now I have to call WebDeploy manually (see YML), because ASP.NET 5 locks some of the DLLs so that they cannot be overwritten (while the web app is running).

The existing "take app offline" setting for the WebDeploy provider does not work in this case, probably because ASP.NET 5 does not actually run inside IIS, but using the Kestrel server (via IIS handler) and App_Offline.htm seems to have no effect. But there's a WebDeploy command to recycle the app pool, this is enough to remove the lock on the DLL files, enabling a deploy without errors.

It would be nice if AppVeyors WebDeploy provider would support this recycleApp WebDeploy command somehow, for example run it if the "ASP.NET 5" and "take app offline" setting are both set? Then I could use the much nicer WebDeploy provider instead of my workaround.

What do you think?

  1. Support Staff 1 Posted by Feodor Fitsner on 30 Oct, 2015 01:10 AM

    Feodor Fitsner's Avatar

    Great idea. I'm just wondering if recycleApp provider works for Azure Web Apps as well? Have you tried that by chance?

  2. 2 Posted by hannes on 30 Oct, 2015 06:26 AM

    hannes's Avatar

    No, I have not tried it for Azure Web Apps, I don't use those atm.

  3. 3 Posted by Qingyu Zhou on 03 Nov, 2015 08:06 PM

    Qingyu Zhou's Avatar

    To add to hannes's point, I'm having file locking issue as well with ASP.NET MVC 5 project (Orchard CMS to be exact) + Azure Web App. Some binaries files in App_Data would get locked, so if I check "Remove extra files" feature in the deployment environment settings, it will fail at cleaning up these extra files.

    To work around that, right now I have to add custom scripts to stop the web app before deployment and start the web app afterwards. It would be nice if "recycle" or "restart" can be specified in the settings.

    Another drawback of using scripts to start/stop web app is that it couldn't react to multiple deployment environments in the same build, nor the "environment"-originated deployments (vs. build-originated deployments). I would imagine that adding the capability of "recycleApp" to individual deployment environment will solve this problem.

  4. Support Staff 4 Posted by Feodor Fitsner on 03 Nov, 2015 08:08 PM

    Feodor Fitsner's Avatar

    I've just checked - recycleApp provider is not allowed for Azure Web Apps. What method do you currently use to restart the app - PowerShell?

  5. 5 Posted by Qingyu Zhou on 03 Nov, 2015 08:20 PM

    Qingyu Zhou's Avatar

    That’s unfortunate ☹

    Right now I have to use Azure Powershell cmdlet (I’m glad it’s pre-installed ☺) to restart Azure Web App slot, and yes, it requires importing the Azure subscription owner’s management certificate (I checked it in as a “secure” file). As I would imagine it, it would not be easy for AppVeyor to provide that functionality.

    Well, in that case, if AppVeyor could provide something like “before_every_deploy”/”after_every_deploy” in addition to current before_deploy/after_deploy, that would be nice, as I can run these scripts per (enabled) deployment environment. And “environment variables” in each of those deployment environment can help the per-deployment script to get information about current deployment environment.

    I also noticed that recently “App_Offline” feature does not delete the App_Offline.htm after the deployment completes. I’m not sure it’s an Azure issue or AppVeyor issue yet. I’ll open another topic about this. For a quick look, you can refer to
    build job “a34vk16dbu5cmrgf” from project “chichard”.

  6. Support Staff 6 Posted by Feodor Fitsner on 05 Nov, 2015 04:51 AM

    Feodor Fitsner's Avatar

    I've just blogged about "Deployment projects" simulating "Script" environments:

    I think described approach could be adopted for your scenario.

    Please take a look and let me know if you have any questions or suggestions. Your feedback is appreciated!

  7. 7 Posted by hannes on 05 Nov, 2015 09:10 AM

    hannes's Avatar

    Thanks for the post!

    Just one (probably stupid) question: Why would I not use the `deploy_script` setting in the main project for deployment, but use a separate project for that? Only for better re-usability, or is there another reason?

  8. Support Staff 8 Posted by Feodor Fitsner on 05 Nov, 2015 09:28 PM

    Feodor Fitsner's Avatar

    It allows deploying a build later, much like "Environments".

  9. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:01 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac