IIS deployment fails if there is no binding specified

revolter00's Avatar


21 Apr, 2017 02:38 PM

Hi, If I try to deploy/promote a package to an environment with the "Deploy IIS WebSite" task without bindings, I read the error below:

Deploying package ...
Transforming 'Web.Release.config'
Making sure a Website is configured in IIS...
foreach-object : You cannot call a method on a null-valued expression.
At Octopus.Features.IISWebSite_BeforePostDeploy.ps1:453 char:31
+         $bindingString.Split("|") | foreach-object {
+                                     ~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.ForEachObjectCommand
Octopus.Features.IISWebSite_BeforePostDeploy.ps1 returned non-zero exit code: 1
Running rollback conventions...
Script 'Octopus.Features.IISWebSite_BeforePostDeploy.ps1' returned non-zero exit code: 1
The remote script failed with exit code 1


What I am trying to do is setting and managing multiple http and https bindings with sni from another step via ps. My workaround was setting a dummy wildcard binding and deleting it prior to my required entries.

  1. Support Staff 1 Posted by Dalmiro Grañas on 21 Apr, 2017 04:14 PM

    Dalmiro Grañas's Avatar


    Thanks for reaching out! We handle IIS bidings in a declarative way, meaning we clear them up first, and then we put the ones you declared. If you don't put any bindings, you'll get this error as Sites without bindings cannot exist.

    What you are doing of setting a dummy binding and the deleting it from the other step is exactly what I would recommend.

    Please let me know if you have any further questions.

    Best regards,

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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