TheRocket
Posts: 31
Joined: Thu Jul 26, 2012 6:55 pm

Repair mode - Stop application pool before Zip Extract before XML update

Hi!

I have an issue in my project: Basically, the project is creating IIS application pool and application (in .Net Core 3.1), extract the content of a zip in a folder in wwwroot sub folder, and update an XML configuration file. (Tweaked the project install sequence tables to zip extract near "Duplicate Files" sequence). The application is also set to auto start.

When performing a repair on the installation, it seems that the applications pools are not stopped before extracting the content of the zip. So, the files are in use and the Zip extract fails with an error, and the repair rollbacks. I can manually stop the application pools before doing the repair and it works.

I suppose I can use some powershell scripts to stop the application pools during a repair operation, but I guess it should be fixed somewhat in default projects sequences?
Or tweaking with the use of app_offline files to gracefully shutdown the application before the repair does it's magic...

I can try to reproduce with a mini project instead of my big featured project if needed.

Thanks!
TheRocket
Posts: 31
Joined: Thu Jul 26, 2012 6:55 pm

Re: Repair mode - Stop application pool before Zip Extract before XML update

Forgot to say I'm working with Version 16.9 (D24925F7)
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Repair mode - Stop application pool before Zip Extract before XML update

Hello,

I am afraid this is our default implementation. During a repair operation the app pools are not stopped. So, the only workaround solution for now would be creating your own custom action to stop the app pool.

However, to fully investigate your scenario test case it will greatly help us if you could isolate this behavior into a small sample. So, if you could share with us a sample project replicating this behavior this will be great.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
TheRocket
Posts: 31
Joined: Thu Jul 26, 2012 6:55 pm

Re: Repair mode - Stop application pool before Zip Extract before XML update

Hi Daniel,

I've sent to support email a link to download the sample project.

Few basics:
1- I've added prerequisites as it needs .Net Core 3.1 and IIS installed beforehand, so you get a correct system.
2- It is a .Net Core 3.1 web application, published and packed as a zip. the installed does the Zip Extract, and configure the web.config file with altered sequence.
3- The web pool is configured to start immediately and enable preload. So as soon as the site is installed, the app starts and loads.
4- When correctly installed, the http://localhost/demoapp should respond with a demo web application and confirms all modules are loaded.
5- Attempting a repair immediately after installation causes the issue (zip cannot be extracted, due to files in use by the app pool).
6- Stopping the application pool before attempting repair works as expected.
7- Uninstalling the project causes no issues at all, so I guess at this stage, the app pool is stopped before files removal.

Since .Net Core apps are self contained in a directory, deploying a zip was more practical than version control on each dll used in the project. This may be the cause why the installer doesn't know the files are in use...

Feel free to reply to my email if you need anything!

Thanks!
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Repair mode - Stop application pool before Zip Extract before XML update

Hi,

Thank you for your sent sample. I have tested it and replicated the behavior.

I can confirm you this is the default behavior as we do not stop and restart the app pools on a product repair.

As a workaround for this you can create two custom actions that will run on repair: one to stop the app pool and the other to start it aftre your file extract operation ends. For instance you can use two BAT files like this:

Code: Select all

%WINDIR%\System32\inetsrv\appcmd start apppool /apppool.name:"DemoAppPool"

Code: Select all

%WINDIR%\System32\inetsrv\appcmd stop apppool /apppool.name:"DemoAppPool"
Then you can add them as temporary files to your setup project and call them on maintenance mode using two "Launch file" custom actions.

I have edited your sample to include such custom actions and send it by email.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”