IIS Deployment - Environment Bindings - Custom Expression

So, I’m experimenting with Octopus to see if it’s a valid solution for our deployment process. For our web deployments, we have bindings that differ between environments. I created an IIS step for each website that needs deploying. I created each binding needed in each environment. I then tried to use a custom expression for the ‘Enabled’ value in each binding - basically, I just referenced a variable that has either the value of “True” or “False” depending on the environment. I’ve attached screenshots of the error, the binding configuration, and the variables set in the release that I attempted to deploy. I also included the raw log. It seems the variable is being read as a string, but the script that deals with the IIS bindings is expecting a boolean value? Have I done something incorrectly or is there a better way to do this?

Or is this simply not possible?

ServerTasks-535.log.txt (219 KB)

Hi,

Thanks for reaching out!

I can see no trace of the variable DevBinding being assigned any value during the deployment. Is it possible that you added the variable DevBinding to your project variables, but you didn’t create a new release after that? You need to create a new release so the new variables can show up during your deployment.

Let me know if you get the same error after you create a new release and deploy it. If you do, please send your new deployment log.

Thanks,
Dalmiro

Hi Dalmiro,

I didn’t see it either. I thought I was missing it or that I was simply doing something incorrectly. So, while I was following your instructions and taking screenshots along the way, I noticed something strange about the “DevBinding” variable I had created (I’ve attached the screenshot). There appeared to be a semicolon in front of “DEV” under the variable’s scope. I deleted the variable and recreated it. The IIS step is now working and behaving as expected.

Earlier in my tinkering I had created an environment that I later removed. I’m beginning to wonder if I had included this now-removed environment in the DevBinding variable’s scope and it was now showing as a null or empty value. This could explain the error I was seeing. Regardless, it seems like it’s finally working!

Thank you for your time!

That totally makes sense. Glad to hear its working now!

Cheers