IIS Reset not working in all environments

I have inherited the maintenance of our Octopus deployment process from a co-worker who is no longer with our company.

In our deployment process we have the following environments:

BETA (used by a select group of our customers to test pre-release changes)

When deploying to the various environments we perform the following actions.

  1. IIS AppPool Restart - We have one of these steps per environment.
  2. IIS Website Restart - This is run only once since all environments are on the same IIS server.
  3. Deploy BuGet package for our site.
  4. Clean up BIN Folder - We have one of these steps per environment. This allows us to clean out prior versions of 3rd party DLLS (DevExpress) when we’re upgrading to a new version.
  5. Deploy to Environment - We have one of these steps per environment.

Overall this process works great, though I am sure it could be improved.

However, most of the time when I try to deploy the site to BETA I always get an access denied error because IIS doesn’t release a DLL we coded and use in our site. This issue only happens in the BETA environment and though it doesn’t always happen, 99% of the time it will.

I know this may be a shot in the dark, but does anyone have any thoughts on why this issue would only happen in this one environment?

Hi Chris,

Thanks for reaching out. Lots of things could be influencing this delay in IIS releasing the DLLs. In my experience with IIS I’ve always found that the following steps always help to avoid this scenario:

  1. Stop the website
  2. Wait a few secs before deploying the code to the site. From powershell you can do it using start-sleep -seconds 30.
  3. Deploy the code.
  4. Start the website

Restarting the AppPool is not always necessary, at least in my experience.

I’m pretty sure that If you follow the above steps, specially the 2nd one with the sleep, you won’t get this DLL locking anymore.

Hope that helps!

Thanks. I’ve made the suggested change to our process and I’ll keep an eye on it.

I thought the 30 second delay had fixed the issue, but I’ve started getting the issue again. Not sure what to try next, since this is the only environment with the issue.

Hi Cris,

If the 30 second delay worked in the first place, but then it stopped working, then It’ll all points to IIS taking even longer to release the files.

  • Which version of Octopus are you running?
  • Are you running steps in parallel?
  • You say this happens only in the Beta environment. How many machines you have in this environment and is it happening in all of them?


Yeah, it definitely worked for a while and only recently started giving issues again.

  1. We running version
  2. I am not sure if anything is running in parallel, since I didn’t originally configure Octopus and only recently inherited the maintenance of our workflow.
  3. All the environments I listed in my original post are all on the same virtual server and running as their own sites in IIS.

I have attached a screenshot showing our deployment process, if it’ll help. Most of this was setup by a former employee and it contains some redundancies. Some may not be needed and some, like the cleaning of the BIN folder, was necessary.

I’ve also attached a screenshot of our IIS AppPool Restart and IIS Restart PowerShell scripts, if they help.




Hi Chris,

Given that you just inherited this system, I believe the best would be to schedule a call and walk together through those steps you have there to find the root cause behind this. If you are up to it, please select a time from the link below:



Thanks, I’ve scheduled 9/6/2016 at 8:15 am.

I apologize that I missed the meeting yesterday. I completely forgot about it coming back from a 3 day weekend.

If we could reschedule that would be great.

Hi Chris,

No worries. Feel free to select a new time on the same link as before.


Thanks, I picked 2 pm this Friday. Just need the GTM link sent over. :slight_smile:

I’ll send you that a couple of minutes before the call.

Talk to you soon!

HI Chris,

Here’s the call info for today:

1.  Please join my meeting.

2.  Use your microphone and speakers (VoIP) - a headset is recommended.  Or, call in using your telephone.

Australia: +61 2 8355 1034
United States: +1 (224) 501-3316

Access Code: 160-383-629
Audio PIN: Shown after joining the meeting

Meeting ID: 160-383-629

Talk to you soon,


We’ve removed the COM component from our .NET Solution (I’m still not sure why it was ever there), so hopefully we can get rid of the AppPool and IIS Restart steps in our deployment process.

During our call you had mentioned a way to archive, or create a backup/copy, of our current build process. How exactly is that done? Also, if I archive it, then remove the AppPool and IIS Restart steps, can we revert back to the archived setup, if we need to?

Hi Chris,

The way to import/export your project’s build process is using this tool: http://docs.octopusdeploy.com/display/OD/Octopus.Migrator.exe+Command+Line

With it you’ll basically be taking a snapshot of your deployment process at that moment in some JSON documents.

Also, if I archive it, then remove the AppPool and IIS Restart steps, can we revert back to the archived setup, if we need to?

As long as you have a copy of the deployment process that still included those 2 steps, you can always import it back again.


Hi Dalmiro,

A while back you were able to help me make some changes to our Octopus Deploy process and now we’re getting ready to add a new Project and Deployment Target.

Back when we talked you has said we didn’t have our Environments configured properly and we should fix them when we update to the latest version of Octopus. Even though we’re adding a new Project and Deployment Target I don’t think we’ll have time to perform the upgrade.

Is there any way we can schedule another meeting so that I can get an understanding of how to make the new Project deploy to the the Target?


Hi Chris,

I don’t quite remember what was wrong with your environment setup, so yeah I think the best would be to setup a quick call to talk about it :). Feel free to book a time in my calendar after the new year: https://calendly.com/dalmirogranias



I’ve setup up the meeting for January 4th at 8:45 am. I’ll probably have a couple of my colleagues on the call as well, if that’s ok.