How to ensure that IIS application remains "off" during deployment and during execution of deploy.ps1
My understanding is that the application (or rather the AppPool) is off while deployment takes place. However, it's not off during execution of deploy.ps1. This is a problem for me because I am setting database connection info to appsettings.json file during execution of deploy.ps1. I set the connection info from the Environment variables.
So in the space of time when deploy.ps1 is executing, I have a ton of errors in the event viewer, because database connection info hasn't been set yet.
My code for reference (and a screenshot of environment variables from the deployment settings in attached as well):
Set-Location $env:application_path
$as = 'appsettings.json'
$a = Get-Content $as | ConvertFrom-Json
$a.Service.ServiceStart = $env:ServiceStart
$a.Service.ServiceEnd = $env:ServiceEnd
$a.Service.ServiceMode = $env:ServiceMode
$a | ConvertTo-Json | set-content $as
So how do I keep the application from running until after deploy.ps1 has executed?
P.S. The app_offline setting is true
Keyboard shortcuts
Generic
| ? | 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

Support Staff 1 Posted by Feodor Fitsner on 24 Jul, 2025 04:54 PM
app_offlineis applied to a WebDeploy provider. I suspect it could behave differently for "regular" .NET Framework websites and .NET Core websites. Anyway, you can providebefore_deploy.ps1and explicitly stop application pool.2 Posted by rgelb on 24 Jul, 2025 05:57 PM
@Feodor, is there such a thing as after-deploy.ps1? Gemini seems to hallucinate and say that there is. But I don't see it in your documentation.
Support Staff 3 Posted by Feodor Fitsner on 24 Jul, 2025 08:53 PM
Correct, it's
before-deploy.ps1(with dash): https://www.appveyor.com/docs/deployment/agent/#running-powershell-...APPLICATION_PATHis probably what you need.4 Posted by rgelb on 24 Jul, 2025 09:45 PM
Can you also please update documentation. https://www.appveyor.com/docs/deployment/agent/ is missing APPLICATION_APPPOOL_NAME.
As far as APPLICATION_PATH, in my case it's C:\appveyor\projects\jw-web\applications\JudicateWest.Web.UI. However, nothing is ever created under C:\appveyor\projects during the deployment. So that is incorrect.
And is there such a thing as after-deploy.ps1? Gemini seems to hallucinate and say that there is. But I don't see it in your documentation.
Support Staff 5 Posted by Feodor Fitsner on 30 Jul, 2025 01:26 AM
Could you please confirm what
APPLICATION_PATHgives in your case?There is no
after-deploy.ps1- there is justdeploy.ps1, but it's technically "after" deploy.6 Posted by rgelb on 02 Aug, 2025 12:49 AM
@Feodor
APPLICATION_PATH = C:\appveyor\projects\jw-web\applications\JudicateWest.Web.UI
and there are also these:
APPLICATION_APPLICATION_PATH = C:\inetpub\wwwroot\netCore7Apps\jwweb2.dev
APPLICATION_APPPOOL_NAME = jwweb2.dev