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,

  2. 2 Posted by mikael on 28 Jun, 2017 10:22 PM

    mikael's Avatar


    I'm adding hostnames runtime to the site ...

    What options do I have for skipping this step? This is ... well ... a pain atm ... not sure how to solve it ...

    I have a few default ... but the rest ... I have no way of knowing.

    Please let us skip the binding step.

  3. 3 Posted by mikael on 28 Jun, 2017 10:27 PM

    mikael's Avatar

    Ahhh, feature of Deploy Package ... :-)

    Sweet ... that fixed it.

  4. 4 Posted by ZZ on 18 Jul, 2017 01:36 PM

    ZZ's Avatar

    hi Mikael,

    Having the same issue, getting nowhere, even tried 'IIS Bindings - Backup' from the library and it seems not backup all the bindings, only http/https.
    How did you manage to fix this?


  5. Support Staff 5 Posted by Kenneth Bates on 18 Jul, 2017 11:14 PM

    Kenneth Bates's Avatar

    Hi @ZZ,

    Thanks for reaching out! In case @Mikael isn't available to respond, you can feel free to get in touch with Octopus support directly with a new thread or email us at Support at Octopus dot com. :)

    Best regards,


  6. 6 Posted by xtcsuk on 19 Jul, 2017 07:47 AM

    xtcsuk's Avatar

    Hi Kenny,

    Thanks for your prompt response, here what my problem is:
    We have an existing (legacy) website and trying Octopus Deployment to
    automate the process, all seems to be good so far, except the bindings.
    This is the current bingdings (most of which not sure about, but want to
    keep it as is) and I tried all possible scenarios I could do to address it
    but the issue still persist, I tried 'IIS Bindings - Backup/Restore'
    powershell scripts from the library so not sure what to do next. For now,
    decided to manually create these bindings after the deployment step.

    Current bindings:

    Type Binding information
    Port SSL certificate
    net.tcp 808:*
    443 some-certificate.com
    net.msmq localhhost
    msmq.formatname localhost
    net.pipe *


  7. Support Staff 7 Posted by Kenneth Bates on 20 Jul, 2017 05:44 AM

    Kenneth Bates's Avatar

    Hi ZZ,

    Thanks for following up! I'm just replying here quickly to let you know that I've responded to your email, and we can continue this discussion there. :)

    Best regards,


  8. Paul Stovell closed this discussion on 03 Nov, 2017 10:33 PM.

Comments are currently closed for this discussion. You can start a new one.

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