IIS deployment fails if there is no binding specified

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

Octopus.Features.IISWebSite_BeforePostDeploy.ps1

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.

Hi,

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,
Dalmiro

Hi,

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.

Ahhh, feature of Deploy Package … :slight_smile:

Sweet … that fixed it.

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?

Thanks,
ZZ

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. :slight_smile:

Best regards,

Kenny

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:*
https
443 some-certificate.com
net.msmq localhhost
msmq.formatname localhost
net.pipe *
http
80

Thanks,
ZZ

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. :slight_smile:

Best regards,

Kenny